Skip to content

Commit 9c00e1b

Browse files
Al ViroKernel Patches Daemon
authored andcommitted
convert nfsctl
One instance per net-ns. There's a fixed subset (several files in root, an optional symlink in root + initially empty /clients/) + per-client subdirectory in /clients/. Clients can appear only after the filesystem is there and they are all gone before it gets through ->kill_sb(). Fixed subset created in fill_super(), regular files by simple_fill_super(), then a subdirectory and a symlink - manually. It is removed by kill_litter_super(). Per-client subdirectories are created by nfsd_client_mkdir() (populated with client-supplied list of files in them). Removed by nfsd_client_rmdir(), which is simple_recursive_removal(). All dentries except for the ones from simple_fill_super() come from * nfsd_mkdir() (subdirectory, dentry from simple_start_creating()). Called from fill_super() (creates initially empty /clients) and from nfsd_client_mkdir (creates a per-client subdirectory in /clients). * _nfsd_symlink() (symlink, dentry from simple_start_creating()), called from fill_super(). * nfsdfs_create_files() (regulars, dentry from simple_start_creating()), called only from nfsd_client_mkdir(). Turn d_instatiate() + inode_unlock() into d_make_persistent() + simple_done_creating() in nfsd_mkdir(), _nfsd_symlink() and nfsdfs_create_files() and we are done. Signed-off-by: Al Viro <[email protected]>
1 parent 1a00807 commit 9c00e1b

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

fs/nfsd/nfsctl.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1137,11 +1137,11 @@ static struct dentry *nfsd_mkdir(struct dentry *parent, struct nfsdfs_client *nc
11371137
inode->i_private = ncl;
11381138
kref_get(&ncl->cl_ref);
11391139
}
1140-
d_instantiate(dentry, inode);
1140+
d_make_persistent(dentry, inode);
11411141
inc_nlink(dir);
11421142
fsnotify_mkdir(dir, dentry);
1143-
inode_unlock(dir);
1144-
return dentry;
1143+
simple_done_creating(dentry);
1144+
return dentry; // borrowed
11451145
}
11461146

11471147
#if IS_ENABLED(CONFIG_SUNRPC_GSS)
@@ -1170,9 +1170,9 @@ static void _nfsd_symlink(struct dentry *parent, const char *name,
11701170
inode->i_link = (char *)content;
11711171
inode->i_size = strlen(content);
11721172

1173-
d_instantiate(dentry, inode);
1173+
d_make_persistent(dentry, inode);
11741174
fsnotify_create(dir, dentry);
1175-
inode_unlock(dir);
1175+
simple_done_creating(dentry);
11761176
}
11771177
#else
11781178
static inline void _nfsd_symlink(struct dentry *parent, const char *name,
@@ -1228,11 +1228,11 @@ static int nfsdfs_create_files(struct dentry *root,
12281228
kref_get(&ncl->cl_ref);
12291229
inode->i_fop = files->ops;
12301230
inode->i_private = ncl;
1231-
d_instantiate(dentry, inode);
1231+
d_make_persistent(dentry, inode);
12321232
fsnotify_create(dir, dentry);
12331233
if (fdentries)
1234-
fdentries[i] = dentry;
1235-
inode_unlock(dir);
1234+
fdentries[i] = dentry; // borrowed
1235+
simple_done_creating(dentry);
12361236
}
12371237
return 0;
12381238
}
@@ -1346,7 +1346,7 @@ static void nfsd_umount(struct super_block *sb)
13461346

13471347
nfsd_shutdown_threads(net);
13481348

1349-
kill_litter_super(sb);
1349+
kill_anon_super(sb);
13501350
put_net(net);
13511351
}
13521352

0 commit comments

Comments
 (0)