Merge tag 'block-5.13-2021-05-14' of git://git.kernel.dk/linux-block
[linux-2.6-microblaze.git] / fs / nfsd / nfsctl.c
index ef86ed2..c2c3d90 100644 (file)
@@ -1166,6 +1166,7 @@ static struct inode *nfsd_get_inode(struct super_block *sb, umode_t mode)
                inode->i_fop = &simple_dir_operations;
                inode->i_op = &simple_dir_inode_operations;
                inc_nlink(inode);
+               break;
        default:
                break;
        }
@@ -1266,7 +1267,8 @@ static void nfsdfs_remove_files(struct dentry *root)
 /* XXX: cut'n'paste from simple_fill_super; figure out if we could share
  * code instead. */
 static  int nfsdfs_create_files(struct dentry *root,
-                                       const struct tree_descr *files)
+                               const struct tree_descr *files,
+                               struct dentry **fdentries)
 {
        struct inode *dir = d_inode(root);
        struct inode *inode;
@@ -1275,8 +1277,6 @@ static  int nfsdfs_create_files(struct dentry *root,
 
        inode_lock(dir);
        for (i = 0; files->name && files->name[0]; i++, files++) {
-               if (!files->name)
-                       continue;
                dentry = d_alloc_name(root, files->name);
                if (!dentry)
                        goto out;
@@ -1290,6 +1290,8 @@ static  int nfsdfs_create_files(struct dentry *root,
                inode->i_private = __get_nfsdfs_client(dir);
                d_add(dentry, inode);
                fsnotify_create(dir, dentry);
+               if (fdentries)
+                       fdentries[i] = dentry;
        }
        inode_unlock(dir);
        return 0;
@@ -1301,8 +1303,9 @@ out:
 
 /* on success, returns positive number unique to that client. */
 struct dentry *nfsd_client_mkdir(struct nfsd_net *nn,
-               struct nfsdfs_client *ncl, u32 id,
-               const struct tree_descr *files)
+                                struct nfsdfs_client *ncl, u32 id,
+                                const struct tree_descr *files,
+                                struct dentry **fdentries)
 {
        struct dentry *dentry;
        char name[11];
@@ -1313,7 +1316,7 @@ struct dentry *nfsd_client_mkdir(struct nfsd_net *nn,
        dentry = nfsd_mkdir(nn->nfsd_client_dir, ncl, name);
        if (IS_ERR(dentry)) /* XXX: tossing errors? */
                return NULL;
-       ret = nfsdfs_create_files(dentry, files);
+       ret = nfsdfs_create_files(dentry, files, fdentries);
        if (ret) {
                nfsd_client_rmdir(dentry);
                return NULL;
@@ -1416,6 +1419,8 @@ static void nfsd_umount(struct super_block *sb)
 {
        struct net *net = sb->s_fs_info;
 
+       nfsd_shutdown_threads(net);
+
        kill_litter_super(sb);
        put_net(net);
 }
@@ -1428,18 +1433,6 @@ static struct file_system_type nfsd_fs_type = {
 };
 MODULE_ALIAS_FS("nfsd");
 
-int get_nfsdfs(struct net *net)
-{
-       struct nfsd_net *nn = net_generic(net, nfsd_net_id);
-       struct vfsmount *mnt;
-
-       mnt =  vfs_kern_mount(&nfsd_fs_type, SB_KERNMOUNT, "nfsd", NULL);
-       if (IS_ERR(mnt))
-               return PTR_ERR(mnt);
-       nn->nfsd_mnt = mnt;
-       return 0;
-}
-
 #ifdef CONFIG_PROC_FS
 static int create_proc_exports_entry(void)
 {