Skip to content

Commit 083176c

Browse files
committed
Merge tag 'nfsd-5.8-1' of git://linux-nfs.org/~bfields/linux
Pull nfsd fixes from Bruce Fields: "Fixes for a umask bug on exported filesystems lacking ACL support, a leak and a module unloading bug in the /proc/fs/nfsd/clients/ code, and a compile warning" * tag 'nfsd-5.8-1' of git://linux-nfs.org/~bfields/linux: SUNRPC: Add missing definition of ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE nfsd: fix nfsdfs inode reference count leak nfsd4: fix nfsdfs reference count loop nfsd: apply umask on fs without ACL support
2 parents 7cc2a8e + becd201 commit 083176c

File tree

5 files changed

+30
-11
lines changed

5 files changed

+30
-11
lines changed

fs/nfsd/nfs4state.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7912,9 +7912,14 @@ nfs4_state_start_net(struct net *net)
79127912
struct nfsd_net *nn = net_generic(net, nfsd_net_id);
79137913
int ret;
79147914

7915-
ret = nfs4_state_create_net(net);
7915+
ret = get_nfsdfs(net);
79167916
if (ret)
79177917
return ret;
7918+
ret = nfs4_state_create_net(net);
7919+
if (ret) {
7920+
mntput(nn->nfsd_mnt);
7921+
return ret;
7922+
}
79187923
locks_start_grace(net, &nn->nfsd4_manager);
79197924
nfsd4_client_tracking_init(net);
79207925
if (nn->track_reclaim_completes && nn->reclaim_str_hashtbl_size == 0)
@@ -7984,6 +7989,7 @@ nfs4_state_shutdown_net(struct net *net)
79847989

79857990
nfsd4_client_tracking_exit(net);
79867991
nfs4_state_destroy_net(net);
7992+
mntput(nn->nfsd_mnt);
79877993
}
79887994

79897995
void

fs/nfsd/nfsctl.c

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1335,6 +1335,7 @@ void nfsd_client_rmdir(struct dentry *dentry)
13351335
WARN_ON_ONCE(ret);
13361336
fsnotify_rmdir(dir, dentry);
13371337
d_delete(dentry);
1338+
dput(dentry);
13381339
inode_unlock(dir);
13391340
}
13401341

@@ -1424,6 +1425,18 @@ static struct file_system_type nfsd_fs_type = {
14241425
};
14251426
MODULE_ALIAS_FS("nfsd");
14261427

1428+
int get_nfsdfs(struct net *net)
1429+
{
1430+
struct nfsd_net *nn = net_generic(net, nfsd_net_id);
1431+
struct vfsmount *mnt;
1432+
1433+
mnt = vfs_kern_mount(&nfsd_fs_type, SB_KERNMOUNT, "nfsd", NULL);
1434+
if (IS_ERR(mnt))
1435+
return PTR_ERR(mnt);
1436+
nn->nfsd_mnt = mnt;
1437+
return 0;
1438+
}
1439+
14271440
#ifdef CONFIG_PROC_FS
14281441
static int create_proc_exports_entry(void)
14291442
{
@@ -1451,7 +1464,6 @@ unsigned int nfsd_net_id;
14511464
static __net_init int nfsd_init_net(struct net *net)
14521465
{
14531466
int retval;
1454-
struct vfsmount *mnt;
14551467
struct nfsd_net *nn = net_generic(net, nfsd_net_id);
14561468

14571469
retval = nfsd_export_init(net);
@@ -1478,16 +1490,8 @@ static __net_init int nfsd_init_net(struct net *net)
14781490
init_waitqueue_head(&nn->ntf_wq);
14791491
seqlock_init(&nn->boot_lock);
14801492

1481-
mnt = vfs_kern_mount(&nfsd_fs_type, SB_KERNMOUNT, "nfsd", NULL);
1482-
if (IS_ERR(mnt)) {
1483-
retval = PTR_ERR(mnt);
1484-
goto out_mount_err;
1485-
}
1486-
nn->nfsd_mnt = mnt;
14871493
return 0;
14881494

1489-
out_mount_err:
1490-
nfsd_reply_cache_shutdown(nn);
14911495
out_drc_error:
14921496
nfsd_idmap_shutdown(net);
14931497
out_idmap_error:
@@ -1500,7 +1504,6 @@ static __net_exit void nfsd_exit_net(struct net *net)
15001504
{
15011505
struct nfsd_net *nn = net_generic(net, nfsd_net_id);
15021506

1503-
mntput(nn->nfsd_mnt);
15041507
nfsd_reply_cache_shutdown(nn);
15051508
nfsd_idmap_shutdown(net);
15061509
nfsd_export_shutdown(net);

fs/nfsd/nfsd.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,8 @@ void nfsd_destroy(struct net *net);
9090

9191
bool i_am_nfsd(void);
9292

93+
int get_nfsdfs(struct net *);
94+
9395
struct nfsdfs_client {
9496
struct kref cl_ref;
9597
void (*cl_release)(struct kref *kref);
@@ -100,6 +102,7 @@ struct dentry *nfsd_client_mkdir(struct nfsd_net *nn,
100102
struct nfsdfs_client *ncl, u32 id, const struct tree_descr *);
101103
void nfsd_client_rmdir(struct dentry *dentry);
102104

105+
103106
#if defined(CONFIG_NFSD_V2_ACL) || defined(CONFIG_NFSD_V3_ACL)
104107
#ifdef CONFIG_NFSD_V2_ACL
105108
extern const struct svc_version nfsd_acl_version2;

fs/nfsd/vfs.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1226,6 +1226,9 @@ nfsd_create_locked(struct svc_rqst *rqstp, struct svc_fh *fhp,
12261226
iap->ia_mode = 0;
12271227
iap->ia_mode = (iap->ia_mode & S_IALLUGO) | type;
12281228

1229+
if (!IS_POSIXACL(dirp))
1230+
iap->ia_mode &= ~current_umask();
1231+
12291232
err = 0;
12301233
host_err = 0;
12311234
switch (type) {
@@ -1458,6 +1461,9 @@ do_nfsd_create(struct svc_rqst *rqstp, struct svc_fh *fhp,
14581461
goto out;
14591462
}
14601463

1464+
if (!IS_POSIXACL(dirp))
1465+
iap->ia_mode &= ~current_umask();
1466+
14611467
host_err = vfs_create(dirp, dchild, iap->ia_mode, true);
14621468
if (host_err < 0) {
14631469
fh_drop_write(fhp);

net/sunrpc/svcsock.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
#include <net/tcp.h>
4545
#include <net/tcp_states.h>
4646
#include <linux/uaccess.h>
47+
#include <linux/highmem.h>
4748
#include <asm/ioctls.h>
4849

4950
#include <linux/sunrpc/types.h>

0 commit comments

Comments
 (0)