Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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 <viro@zeniv.linux.org.uk>

Al Viro 0c9a2668 946e2256

+9 -9
+9 -9
fs/nfsd/nfsctl.c
··· 1137 1137 inode->i_private = ncl; 1138 1138 kref_get(&ncl->cl_ref); 1139 1139 } 1140 - d_instantiate(dentry, inode); 1140 + d_make_persistent(dentry, inode); 1141 1141 inc_nlink(dir); 1142 1142 fsnotify_mkdir(dir, dentry); 1143 - inode_unlock(dir); 1144 - return dentry; 1143 + simple_done_creating(dentry); 1144 + return dentry; // borrowed 1145 1145 } 1146 1146 1147 1147 #if IS_ENABLED(CONFIG_SUNRPC_GSS) ··· 1170 1170 inode->i_link = (char *)content; 1171 1171 inode->i_size = strlen(content); 1172 1172 1173 - d_instantiate(dentry, inode); 1173 + d_make_persistent(dentry, inode); 1174 1174 fsnotify_create(dir, dentry); 1175 - inode_unlock(dir); 1175 + simple_done_creating(dentry); 1176 1176 } 1177 1177 #else 1178 1178 static inline void _nfsd_symlink(struct dentry *parent, const char *name, ··· 1228 1228 kref_get(&ncl->cl_ref); 1229 1229 inode->i_fop = files->ops; 1230 1230 inode->i_private = ncl; 1231 - d_instantiate(dentry, inode); 1231 + d_make_persistent(dentry, inode); 1232 1232 fsnotify_create(dir, dentry); 1233 1233 if (fdentries) 1234 - fdentries[i] = dentry; 1235 - inode_unlock(dir); 1234 + fdentries[i] = dentry; // borrowed 1235 + simple_done_creating(dentry); 1236 1236 } 1237 1237 return 0; 1238 1238 } ··· 1346 1346 1347 1347 nfsd_shutdown_threads(net); 1348 1348 1349 - kill_litter_super(sb); 1349 + kill_anon_super(sb); 1350 1350 put_net(net); 1351 1351 } 1352 1352