svn commit: r188614 - in stable/7/sys: . contrib/pf dev/ath/ath_hal
dev/cxgb ufs/ffs ufs/ufs
Konstantin Belousov
kib at FreeBSD.org
Sat Feb 14 13:13:00 PST 2009
Author: kib
Date: Sat Feb 14 21:12:58 2009
New Revision: 188614
URL: http://svn.freebsd.org/changeset/base/188614
Log:
MFC r183070:
When downgrading the read-write mount to read-only, do_unmount() sets
MNT_RDONLY flag before the VFS_MOUNT() is called. In ufs_inactive()
and ufs_itimes_locked(), UFS verifies whether the fs is read-only by
checking MNT_RDONLY, but this may cause loss of the IN_MODIFIED flag
for inode on the fs being remounted rw->ro.
Introduce UFS_RDONLY() struct ufsmount' method that reports the value
of the fs_ronly. The later is set to 1 only after the remount is
finished.
Modified:
stable/7/sys/ (props changed)
stable/7/sys/contrib/pf/ (props changed)
stable/7/sys/dev/ath/ath_hal/ (props changed)
stable/7/sys/dev/cxgb/ (props changed)
stable/7/sys/ufs/ffs/ffs_extern.h
stable/7/sys/ufs/ffs/ffs_inode.c
stable/7/sys/ufs/ffs/ffs_vfsops.c
stable/7/sys/ufs/ufs/ufs_inode.c
stable/7/sys/ufs/ufs/ufs_vnops.c
stable/7/sys/ufs/ufs/ufsmount.h
Modified: stable/7/sys/ufs/ffs/ffs_extern.h
==============================================================================
--- stable/7/sys/ufs/ffs/ffs_extern.h Sat Feb 14 21:12:24 2009 (r188613)
+++ stable/7/sys/ufs/ffs/ffs_extern.h Sat Feb 14 21:12:58 2009 (r188614)
@@ -131,4 +131,6 @@ int softdep_process_worklist(struct
int softdep_fsync(struct vnode *);
int softdep_waitidle(struct mount *);
+int ffs_rdonly(struct inode *);
+
#endif /* !_UFS_FFS_EXTERN_H */
Modified: stable/7/sys/ufs/ffs/ffs_inode.c
==============================================================================
--- stable/7/sys/ufs/ffs/ffs_inode.c Sat Feb 14 21:12:24 2009 (r188613)
+++ stable/7/sys/ufs/ffs/ffs_inode.c Sat Feb 14 21:12:58 2009 (r188614)
@@ -665,3 +665,11 @@ ffs_indirtrunc(ip, lbn, dbn, lastbn, lev
*countp = blocksreleased;
return (allerror);
}
+
+int
+ffs_rdonly(struct inode *ip)
+{
+
+ return (ip->i_ump->um_fs->fs_ronly != 0);
+}
+
Modified: stable/7/sys/ufs/ffs/ffs_vfsops.c
==============================================================================
--- stable/7/sys/ufs/ffs/ffs_vfsops.c Sat Feb 14 21:12:24 2009 (r188613)
+++ stable/7/sys/ufs/ffs/ffs_vfsops.c Sat Feb 14 21:12:58 2009 (r188614)
@@ -734,6 +734,7 @@ ffs_mountfs(devvp, mp, td)
ump->um_valloc = ffs_valloc;
ump->um_vfree = ffs_vfree;
ump->um_ifree = ffs_ifree;
+ ump->um_rdonly = ffs_rdonly;
mtx_init(UFS_MTX(ump), "FFS", "FFS Lock", MTX_DEF);
bcopy(bp->b_data, ump->um_fs, (u_int)fs->fs_sbsize);
if (fs->fs_sbsize < SBLOCKSIZE)
Modified: stable/7/sys/ufs/ufs/ufs_inode.c
==============================================================================
--- stable/7/sys/ufs/ufs/ufs_inode.c Sat Feb 14 21:12:24 2009 (r188613)
+++ stable/7/sys/ufs/ufs/ufs_inode.c Sat Feb 14 21:12:58 2009 (r188614)
@@ -90,8 +90,7 @@ ufs_inactive(ap)
ufs_gjournal_close(vp);
#endif
if ((ip->i_effnlink == 0 && DOINGSOFTDEP(vp)) ||
- (ip->i_nlink <= 0 &&
- (vp->v_mount->mnt_flag & MNT_RDONLY) == 0)) {
+ (ip->i_nlink <= 0 && !UFS_RDONLY(ip))) {
loop:
if (vn_start_secondary_write(vp, &mp, V_NOWAIT) != 0) {
/* Cannot delete file while file system is suspended */
@@ -121,7 +120,7 @@ ufs_inactive(ap)
}
if (ip->i_effnlink == 0 && DOINGSOFTDEP(vp))
softdep_releasefile(ip);
- if (ip->i_nlink <= 0 && (vp->v_mount->mnt_flag & MNT_RDONLY) == 0) {
+ if (ip->i_nlink <= 0 && !UFS_RDONLY(ip)) {
#ifdef QUOTA
if (!getinoquota(ip))
(void)chkiq(ip, -1, NOCRED, FORCE);
Modified: stable/7/sys/ufs/ufs/ufs_vnops.c
==============================================================================
--- stable/7/sys/ufs/ufs/ufs_vnops.c Sat Feb 14 21:12:24 2009 (r188613)
+++ stable/7/sys/ufs/ufs/ufs_vnops.c Sat Feb 14 21:12:58 2009 (r188614)
@@ -135,7 +135,7 @@ ufs_itimes_locked(struct vnode *vp)
ASSERT_VI_LOCKED(vp, __func__);
ip = VTOI(vp);
- if ((vp->v_mount->mnt_flag & MNT_RDONLY) != 0)
+ if (UFS_RDONLY(ip))
goto out;
if ((ip->i_flag & (IN_ACCESS | IN_CHANGE | IN_UPDATE)) == 0)
return;
Modified: stable/7/sys/ufs/ufs/ufsmount.h
==============================================================================
--- stable/7/sys/ufs/ufs/ufsmount.h Sat Feb 14 21:12:24 2009 (r188613)
+++ stable/7/sys/ufs/ufs/ufsmount.h Sat Feb 14 21:12:58 2009 (r188614)
@@ -93,6 +93,7 @@ struct ufsmount {
int (*um_valloc)(struct vnode *, int, struct ucred *, struct vnode **);
int (*um_vfree)(struct vnode *, ino_t, int);
void (*um_ifree)(struct ufsmount *, struct inode *);
+ int (*um_rdonly)(struct inode *);
};
#define UFS_BALLOC(aa, bb, cc, dd, ee, ff) VFSTOUFS((aa)->v_mount)->um_balloc(aa, bb, cc, dd, ee, ff)
@@ -102,6 +103,7 @@ struct ufsmount {
#define UFS_VALLOC(aa, bb, cc, dd) VFSTOUFS((aa)->v_mount)->um_valloc(aa, bb, cc, dd)
#define UFS_VFREE(aa, bb, cc) VFSTOUFS((aa)->v_mount)->um_vfree(aa, bb, cc)
#define UFS_IFREE(aa, bb) ((aa)->um_ifree(aa, bb))
+#define UFS_RDONLY(aa) ((aa)->i_ump->um_rdonly(aa))
#define UFS_LOCK(aa) mtx_lock(&(aa)->um_lock)
#define UFS_UNLOCK(aa) mtx_unlock(&(aa)->um_lock)
More information about the svn-src-all
mailing list