Skip to content

Commit 4f37548

Browse files
author
J. Bruce Fields
committed
Merge nfsd bugfixes
These are some nfsd bugfixes that I also want in the main branch that will be submitted for the 5.4 merge window.
2 parents 64a38e8 + 78e70e7 commit 4f37548

File tree

2 files changed

+10
-11
lines changed

2 files changed

+10
-11
lines changed

fs/nfsd/nfscache.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -571,7 +571,7 @@ nfsd_cache_append(struct svc_rqst *rqstp, struct kvec *data)
571571
*/
572572
static int nfsd_reply_cache_stats_show(struct seq_file *m, void *v)
573573
{
574-
struct nfsd_net *nn = v;
574+
struct nfsd_net *nn = m->private;
575575

576576
seq_printf(m, "max entries: %u\n", nn->max_drc_entries);
577577
seq_printf(m, "num entries: %u\n",

fs/nfsd/nfsctl.c

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1171,13 +1171,17 @@ static struct inode *nfsd_get_inode(struct super_block *sb, umode_t mode)
11711171
return inode;
11721172
}
11731173

1174-
static int __nfsd_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode)
1174+
static int __nfsd_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode, struct nfsdfs_client *ncl)
11751175
{
11761176
struct inode *inode;
11771177

11781178
inode = nfsd_get_inode(dir->i_sb, mode);
11791179
if (!inode)
11801180
return -ENOMEM;
1181+
if (ncl) {
1182+
inode->i_private = ncl;
1183+
kref_get(&ncl->cl_ref);
1184+
}
11811185
d_add(dentry, inode);
11821186
inc_nlink(dir);
11831187
fsnotify_mkdir(dir, dentry);
@@ -1194,17 +1198,14 @@ static struct dentry *nfsd_mkdir(struct dentry *parent, struct nfsdfs_client *nc
11941198
dentry = d_alloc_name(parent, name);
11951199
if (!dentry)
11961200
goto out_err;
1197-
ret = __nfsd_mkdir(d_inode(parent), dentry, S_IFDIR | 0600);
1201+
ret = __nfsd_mkdir(d_inode(parent), dentry, S_IFDIR | 0600, ncl);
11981202
if (ret)
11991203
goto out_err;
1200-
if (ncl) {
1201-
d_inode(dentry)->i_private = ncl;
1202-
kref_get(&ncl->cl_ref);
1203-
}
12041204
out:
12051205
inode_unlock(dir);
12061206
return dentry;
12071207
out_err:
1208+
dput(dentry);
12081209
dentry = ERR_PTR(ret);
12091210
goto out;
12101211
}
@@ -1214,11 +1215,9 @@ static void clear_ncl(struct inode *inode)
12141215
struct nfsdfs_client *ncl = inode->i_private;
12151216

12161217
inode->i_private = NULL;
1217-
synchronize_rcu();
12181218
kref_put(&ncl->cl_ref, ncl->cl_release);
12191219
}
12201220

1221-
12221221
static struct nfsdfs_client *__get_nfsdfs_client(struct inode *inode)
12231222
{
12241223
struct nfsdfs_client *nc = inode->i_private;
@@ -1232,9 +1231,9 @@ struct nfsdfs_client *get_nfsdfs_client(struct inode *inode)
12321231
{
12331232
struct nfsdfs_client *nc;
12341233

1235-
rcu_read_lock();
1234+
inode_lock_shared(inode);
12361235
nc = __get_nfsdfs_client(inode);
1237-
rcu_read_unlock();
1236+
inode_unlock_shared(inode);
12381237
return nc;
12391238
}
12401239
/* from __rpc_unlink */

0 commit comments

Comments
 (0)