FYI: [delphij at FreeBSD.org: [src] cvs commit: src/sys/ufs/ufs ufs_inode.c]

Xin LI delphij at frontfree.net
Fri Sep 23 13:57:47 PDT 2005


Hi,

Here is a patch that I have just committed to FreeBSD -CURRENT.  A
similiar problem exists in DragonFly as well, which should be
corrected.

The patch adapted for DragonFly can be found at:
	http://www.delphij.net/patch-ufs-dfly

----- Forwarded message from Xin LI <delphij at xxxxxxxxxxx> -----

Date: Fri, 23 Sep 2005 20:50:17 +0000 (GMT)
From: Xin LI <delphij at xxxxxxxxxxx>
Subject: [src] cvs commit: src/sys/ufs/ufs ufs_inode.c
X-Sieve: CMU Sieve 2.2
Delivered-To: delphij at xxxxxxxxxxx
In-Reply-To: <200509232049.j8NKnvIj024351 at xxxxxxxxxxxxxxxxxxx>
X-Virus-Scanned: amavisd-new at frontfree.net

delphij     2005-09-23 20:49:57 UTC

  FreeBSD src repository

  Modified files:
    sys/ufs/ufs          ufs_inode.c 
  Log:
  Restore a historical ufs_inactive behavior that has been changed
  in rev. 1.40 of ufs_inode.c, which allows an inode being truncated
  even when the filesystem itself is marked RDONLY.  A subsequent
  call of UFS_TRUNCATE (ffs_truncate) would panic the system as it
  asserts that it can only be called when the filesystem is mounted
  read-write (same changeset, rev. 1.74 of sys/ufs/ffs/ffs_inode.c).
  
  Because ffs_mount() already takes care of sync'ing the filesystem
  to disk before being downgraded to readonly, it appears to be more
  desirable that we should not permit this sort of writes to disk.
  
  This change would fix a panic that occours when read-only mounted
  a corrupted filesystem and doing some file operations.
  
  MT6/5/4 candidate
  
  Reviewed by:    mckusick
  
  Revision  Changes    Path
  1.64      +1 -1      src/sys/ufs/ufs/ufs_inode.c


Index: src/sys/ufs/ufs/ufs_inode.c
diff -u src/sys/ufs/ufs/ufs_inode.c:1.63 src/sys/ufs/ufs/ufs_inode.c:1.64
--- src/sys/ufs/ufs/ufs_inode.c:1.63	Thu Mar 17 11:58:43 2005
+++ src/sys/ufs/ufs/ufs_inode.c	Fri Sep 23 20:49:57 2005
@@ -83,7 +83,7 @@
 		goto out;
 	if (ip->i_effnlink == 0 && DOINGSOFTDEP(vp))
 		softdep_releasefile(ip);
-	if (ip->i_nlink <= 0) {
+	if (ip->i_nlink <= 0 && (vp->v_mount->mnt_flag & MNT_RDONLY) == 0) {
 		(void) vn_write_suspend_wait(vp, NULL, V_WAIT);
 #ifdef QUOTA
 		if (!getinoquota(ip))

----- End forwarded message -----

Cheers,
-- 
Xin LI <delphij frontfree net>	http://www.delphij.net/
See complete headers for GPG key and other information.

Attachment:
pgp00004.pgp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pgp00004.pgp
Type: application/octet-stream
Size: 187 bytes
Desc: "Description: PGP signature"
URL: <http://lists.dragonflybsd.org/pipermail/submit/attachments/20050923/c9270a3d/attachment-0014.obj>


More information about the Submit mailing list