Skip to content

Commit 8b512d9

Browse files
Trond MyklebustTrond Myklebust
authored andcommitted
VFS: Remove dependency of ->umount_begin() call on MNT_FORCE
Allow filesystems to decide to perform pre-umount processing whether or not MNT_FORCE is set. Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
1 parent 5528f91 commit 8b512d9

6 files changed

Lines changed: 23 additions & 15 deletions

File tree

‎fs/9p/vfs_super.c‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -253,11 +253,12 @@ static int v9fs_show_options(struct seq_file *m, struct vfsmount *mnt)
253253
}
254254

255255
static void
256-
v9fs_umount_begin(struct super_block *sb)
256+
v9fs_umount_begin(struct vfsmount *vfsmnt, int flags)
257257
{
258-
struct v9fs_session_info *v9ses = sb->s_fs_info;
258+
struct v9fs_session_info *v9ses = vfsmnt->mnt_sb->s_fs_info;
259259

260-
v9fs_session_cancel(v9ses);
260+
if (flags & MNT_FORCE)
261+
v9fs_session_cancel(v9ses);
261262
}
262263

263264
static struct super_operations v9fs_super_ops = {

‎fs/cifs/cifsfs.c‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -402,12 +402,14 @@ static struct quotactl_ops cifs_quotactl_ops = {
402402
#endif
403403

404404
#ifdef CONFIG_CIFS_EXPERIMENTAL
405-
static void cifs_umount_begin(struct super_block * sblock)
405+
static void cifs_umount_begin(struct vfsmount * vfsmnt, int flags)
406406
{
407407
struct cifs_sb_info *cifs_sb;
408408
struct cifsTconInfo * tcon;
409409

410-
cifs_sb = CIFS_SB(sblock);
410+
if (!(flags & MNT_FORCE))
411+
return;
412+
cifs_sb = CIFS_SB(vfsmnt->mnt_sb);
411413
if(cifs_sb == NULL)
412414
return;
413415

‎fs/fuse/inode.c‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -195,9 +195,10 @@ struct inode *fuse_iget(struct super_block *sb, unsigned long nodeid,
195195
return inode;
196196
}
197197

198-
static void fuse_umount_begin(struct super_block *sb)
198+
static void fuse_umount_begin(struct vfsmount *vfsmnt, int flags)
199199
{
200-
fuse_abort_conn(get_fuse_conn_super(sb));
200+
if (flags & MNT_FORCE)
201+
fuse_abort_conn(get_fuse_conn_super(vfsmnt->mnt_sb));
201202
}
202203

203204
static void fuse_put_super(struct super_block *sb)

‎fs/namespace.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -576,8 +576,8 @@ static int do_umount(struct vfsmount *mnt, int flags)
576576
*/
577577

578578
lock_kernel();
579-
if ((flags & MNT_FORCE) && sb->s_op->umount_begin)
580-
sb->s_op->umount_begin(sb);
579+
if (sb->s_op->umount_begin)
580+
sb->s_op->umount_begin(mnt, flags);
581581
unlock_kernel();
582582

583583
/*

‎fs/nfs/inode.c‎

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ static struct inode *nfs_alloc_inode(struct super_block *sb);
6363
static void nfs_destroy_inode(struct inode *);
6464
static int nfs_write_inode(struct inode *,int);
6565
static void nfs_clear_inode(struct inode *);
66-
static void nfs_umount_begin(struct super_block *);
66+
static void nfs_umount_begin(struct vfsmount *, int);
6767
static int nfs_statfs(struct super_block *, struct kstatfs *);
6868
static int nfs_show_options(struct seq_file *, struct vfsmount *);
6969
static int nfs_show_stats(struct seq_file *, struct vfsmount *);
@@ -162,15 +162,19 @@ nfs_clear_inode(struct inode *inode)
162162
BUG_ON(atomic_read(&nfsi->data_updates) != 0);
163163
}
164164

165-
void
166-
nfs_umount_begin(struct super_block *sb)
165+
static void nfs_umount_begin(struct vfsmount *vfsmnt, int flags)
167166
{
168-
struct rpc_clnt *rpc = NFS_SB(sb)->client;
167+
struct nfs_server *server;
168+
struct rpc_clnt *rpc;
169169

170+
if (!(flags & MNT_FORCE))
171+
return;
170172
/* -EIO all pending I/O */
173+
server = NFS_SB(vfsmnt->mnt_sb);
174+
rpc = server->client;
171175
if (!IS_ERR(rpc))
172176
rpc_killall_tasks(rpc);
173-
rpc = NFS_SB(sb)->client_acl;
177+
rpc = server->client_acl;
174178
if (!IS_ERR(rpc))
175179
rpc_killall_tasks(rpc);
176180
}

‎include/linux/fs.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1101,7 +1101,7 @@ struct super_operations {
11011101
int (*statfs) (struct super_block *, struct kstatfs *);
11021102
int (*remount_fs) (struct super_block *, int *, char *);
11031103
void (*clear_inode) (struct inode *);
1104-
void (*umount_begin) (struct super_block *);
1104+
void (*umount_begin) (struct vfsmount *, int);
11051105

11061106
int (*show_options)(struct seq_file *, struct vfsmount *);
11071107
int (*show_stats)(struct seq_file *, struct vfsmount *);

0 commit comments

Comments
 (0)