diff options
author | delphij <delphij@FreeBSD.org> | 2005-09-23 20:49:57 +0000 |
---|---|---|
committer | delphij <delphij@FreeBSD.org> | 2005-09-23 20:49:57 +0000 |
commit | 9bfa6f6c3e2e2d439166242216095acbf98ea2bb (patch) | |
tree | db1d6d0681bcbcfb4990eb603662d240fcc8de86 | |
parent | 49e164220d8f600c58e27cd87f29829032d64116 (diff) | |
download | FreeBSD-src-9bfa6f6c3e2e2d439166242216095acbf98ea2bb.zip FreeBSD-src-9bfa6f6c3e2e2d439166242216095acbf98ea2bb.tar.gz |
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
-rw-r--r-- | sys/ufs/ufs/ufs_inode.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/sys/ufs/ufs/ufs_inode.c b/sys/ufs/ufs/ufs_inode.c index 72a10f1..b7214d2 100644 --- a/sys/ufs/ufs/ufs_inode.c +++ b/sys/ufs/ufs/ufs_inode.c @@ -83,7 +83,7 @@ ufs_inactive(ap) 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)) |