File remove problem
Don Lewis
truckman at FreeBSD.org
Sat Dec 1 14:14:54 PST 2007
On 2 Dec, Bruce Evans wrote:
> Here is a non-hackish patch which explains why ignoring MNT_RDONLY in
> the above or in ffs_mount() helps. It just fixes the confusion between
> IN_MODIFIED and IN_CHANGE in critical places.
>
> % Index: ffs_softdep.c
> % ===================================================================
> % RCS file: /home/ncvs/src/sys/ufs/ffs/ffs_softdep.c,v
> % retrieving revision 1.214
> % diff -u -2 -r1.214 ffs_softdep.c
> % --- ffs_softdep.c 9 Nov 2007 11:04:36 -0000 1.214
> % +++ ffs_softdep.c 1 Dec 2007 14:25:49 -0000
> % @@ -2776,5 +2776,5 @@
> % DIP_SET(ip, i_blocks, DIP(ip, i_blocks) + \
> % freeblks->fb_chkcnt - blocksreleased);
> % - ip->i_flag |= IN_CHANGE;
> % + ip->i_flag |= IN_MODIFIED;
> % vput(vp);
> % }
> % @@ -3575,5 +3575,5 @@
> % ip->i_nlink--;
> % DIP_SET(ip, i_nlink, ip->i_nlink);
> % - ip->i_flag |= IN_CHANGE;
> % + ip->i_flag |= IN_MODIFIED;
> % if (ip->i_nlink < ip->i_effnlink)
> % panic("handle_workitem_remove: bad file delta");
> % @@ -3594,5 +3594,5 @@
> % ip->i_nlink -= 2;
> % DIP_SET(ip, i_nlink, ip->i_nlink);
> % - ip->i_flag |= IN_CHANGE;
> % + ip->i_flag |= IN_MODIFIED;
> % if (ip->i_nlink < ip->i_effnlink)
> % panic("handle_workitem_remove: bad dir delta");
> % @@ -3635,5 +3635,5 @@
> % WORKLIST_INSERT(&inodedep->id_inowait, &dirrem->dm_list);
> % FREE_LOCK(&lk);
> % - ip->i_flag |= IN_CHANGE;
> % + ip->i_flag |= IN_MODIFIED;
> % ffs_update(vp, 0);
> % vput(vp);
>
> Without this change, soft updates depends on IN_CHANGE being converted
> to IN_MODIFIED by ufs_itimes(), but this conversion doesn't happen
> when MNT_RDONLY is set. With soft updates, changes are often delayed
> until sync time, and when the sync is for mount-update it is done after
> setting MNT_RDONLY so the above doesn't work.
ufs_itimes() should probably also be looking at fs_ronly instead of
MNT_RDONLY, *but* all the paths leading from userland to ufs_itimes()
would need to be checked to verify that they check MNT_RDONLY to prevent
new file system write operations from happening while the remount is in
progress.
More information about the freebsd-fs
mailing list