Add needed locking for um_flags added in -r335808.

While here document required locking details in ufsmount structure.

Reported by: kib
Reviewed by: kib
This commit is contained in:
Kirk McKusick 2018-07-17 04:43:58 +00:00
parent 3b3bf2b42a
commit 15430057b3
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=336361
2 changed files with 41 additions and 24 deletions

View File

@ -210,7 +210,9 @@ ffs_susp_suspend(struct mount *mp)
if ((error = vfs_write_suspend(mp, VS_SKIP_UNMOUNT)) != 0)
return (error);
UFS_LOCK(ump);
ump->um_flags |= UM_WRITESUSPENDED;
UFS_UNLOCK(ump);
return (0);
}
@ -255,7 +257,9 @@ ffs_susp_dtor(void *data)
vfs_write_resume(mp, 0);
vfs_unbusy(mp);
UFS_LOCK(ump);
ump->um_flags &= ~UM_WRITESUSPENDED;
UFS_UNLOCK(ump);
sx_xunlock(&ffs_susp_lock);
}

View File

@ -64,31 +64,44 @@ struct inodedep;
TAILQ_HEAD(inodedeplst, inodedep);
LIST_HEAD(bmsafemaphd, bmsafemap);
/* This structure describes the UFS specific mount structure data. */
/*
* This structure describes the UFS specific mount structure data.
* The function operators are used to support different versions of
* UFS (UFS1, UFS2, etc).
*
* Lock reference:
* a - atomic operations
* c - set at allocation then constant until freed
* i - ufsmount interlock (UFS_LOCK / UFS_UNLOCK)
* q - associated quota file is locked
* r - ref to parent mount structure is held (vfs_busy / vfs_unbusy)
* u - managed by user process fsck_ufs
*/
struct ufsmount {
struct mount *um_mountp; /* filesystem vfs structure */
struct cdev *um_dev; /* device mounted */
struct g_consumer *um_cp;
struct bufobj *um_bo; /* Buffer cache object */
struct vnode *um_devvp; /* block device mounted vnode */
u_long um_fstype; /* type of filesystem */
struct fs *um_fs; /* pointer to superblock */
struct ufs_extattr_per_mount um_extattr; /* extended attrs */
u_long um_nindir; /* indirect ptrs per block */
u_long um_bptrtodb; /* indir ptr to disk block */
u_long um_seqinc; /* inc between seq blocks */
struct mtx um_lock; /* Protects ufsmount & fs */
pid_t um_fsckpid; /* PID permitted fsck sysctls */
struct mount_softdeps *um_softdep; /* softdep mgmt structure */
struct vnode *um_quotas[MAXQUOTAS]; /* pointer to quota files */
struct ucred *um_cred[MAXQUOTAS]; /* quota file access cred */
time_t um_btime[MAXQUOTAS]; /* block quota time limit */
time_t um_itime[MAXQUOTAS]; /* inode quota time limit */
char um_qflags[MAXQUOTAS]; /* quota specific flags */
int64_t um_savedmaxfilesize; /* XXX - limit maxfilesize */
u_int um_flags; /* filesystem flags */
u_int um_trim_inflight; /* outstanding trim count */
struct taskqueue *um_trim_tq; /* trim request queue */
struct mount *um_mountp; /* (r) filesystem vfs struct */
struct cdev *um_dev; /* (r) device mounted */
struct g_consumer *um_cp; /* (r) GEOM access point */
struct bufobj *um_bo; /* (r) Buffer cache object */
struct vnode *um_devvp; /* (r) blk dev mounted vnode */
u_long um_fstype; /* (c) type of filesystem */
struct fs *um_fs; /* (r) pointer to superblock */
struct ufs_extattr_per_mount um_extattr; /* (c) extended attrs */
u_long um_nindir; /* (c) indirect ptrs per blk */
u_long um_bptrtodb; /* (c) indir disk block ptr */
u_long um_seqinc; /* (c) inc between seq blocks */
struct mtx um_lock; /* (c) Protects ufsmount & fs */
pid_t um_fsckpid; /* (u) PID can do fsck sysctl */
struct mount_softdeps *um_softdep; /* (c) softdep mgmt structure */
struct vnode *um_quotas[MAXQUOTAS]; /* (q) pointer to quota files */
struct ucred *um_cred[MAXQUOTAS]; /* (q) quota file access cred */
time_t um_btime[MAXQUOTAS]; /* (q) block quota time limit */
time_t um_itime[MAXQUOTAS]; /* (q) inode quota time limit */
char um_qflags[MAXQUOTAS]; /* (i) quota specific flags */
int64_t um_savedmaxfilesize; /* (c) track maxfilesize */
u_int um_flags; /* (i) filesystem flags */
u_int um_trim_inflight; /* (a) outstanding trim count */
struct taskqueue *um_trim_tq; /* (c) trim request queue */
/* (c) - below function ptrs */
int (*um_balloc)(struct vnode *, off_t, int, struct ucred *,
int, struct buf **);
int (*um_blkatoff)(struct vnode *, off_t, char **, struct buf **);