mirror of
https://github.com/edk2-porting/linux-next.git
synced 2024-12-19 18:53:52 +08:00
Fix nfsd bugs, three in the new nfsd/clients/ code, one in the reply
cache containerization. -----BEGIN PGP SIGNATURE----- iQJJBAABCAAzFiEEYtFWavXG9hZotryuJ5vNeUKO4b4FAl1dXZcVHGJmaWVsZHNA ZmllbGRzZXMub3JnAAoJECebzXlCjuG+aeoQALGy/uioZv5H4gdkHrcbdqSGmsTl CNvIL6k94HTkkF8K3+30g000o0zzdkFrX/1nyguaJqftytwmCtocmZP/QdqzWQVT UOel9LFJJn4GwQ7J7JIbpmc0YWK8oey1s1AYTMZG00s6ORVk5J0HfQqrryoGaG+o 9IySxbRKklGCm1J/0mMuPKKMaumiZPMf0GYrnmlMoW4KHg+ROP8e5Xp7VspqUCcv KfpCqO7mcwBKgPez2hIIFBWh+CdoC/8ztymfN+15EBjTfS4Jl8D6v/+XTKs+IW+V YwGiTt1pPBjrMy4nZMqIrSghS2owRoVuXiK/X6n38SQnpcmZEaeHFRYKAq8gZGzl cvHtacVTp75n3gRUwTyE5hDLIpVOAe54doEQKR4rBUQZB6iul3DIkwhoHocQAf52 n+nmOK09CSP8M4uLVBNsfGGn/eU5jcqGY9M+4qoAxdv1/N/VCeQV9Lfx8FBRea2p 5fbo2f+g1nqKOhX6PTYMEg83lWvDwWUKghHNpVai4QQN/z+RRlKiNhKldK2y3Tvm 4ND3bCy++yiPIUlZpsSc6FFCdi+JHVCM1arqM1Irm92J1PzF9CELqhHEe9MAMiWt iZgO/42uWZ2i0aqb3y94/6o9rvaYDABI21vu3yZmyxlHgZuyVT+GY1ggbHn9oSEc sqwLMDwejclsCrIx =irn8 -----END PGP SIGNATURE----- Merge tag 'nfsd-5.3-1' of git://linux-nfs.org/~bfields/linux Pull nfsd fixes from Bruce Fields: "Fix nfsd bugs: three in the new nfsd/clients/ code, one in the reply cache containerization" * tag 'nfsd-5.3-1' of git://linux-nfs.org/~bfields/linux: nfsd4: Fix kernel crash when reading proc file reply_cache_stats nfsd: initialize i_private before d_add nfsd: use i_wrlock instead of rcu for nfsdfs i_private nfsd: fix dentry leak upon mkdir failure.
This commit is contained in:
commit
2babd34df2
@ -571,7 +571,7 @@ nfsd_cache_append(struct svc_rqst *rqstp, struct kvec *data)
|
||||
*/
|
||||
static int nfsd_reply_cache_stats_show(struct seq_file *m, void *v)
|
||||
{
|
||||
struct nfsd_net *nn = v;
|
||||
struct nfsd_net *nn = m->private;
|
||||
|
||||
seq_printf(m, "max entries: %u\n", nn->max_drc_entries);
|
||||
seq_printf(m, "num entries: %u\n",
|
||||
|
@ -1171,13 +1171,17 @@ static struct inode *nfsd_get_inode(struct super_block *sb, umode_t mode)
|
||||
return inode;
|
||||
}
|
||||
|
||||
static int __nfsd_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode)
|
||||
static int __nfsd_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode, struct nfsdfs_client *ncl)
|
||||
{
|
||||
struct inode *inode;
|
||||
|
||||
inode = nfsd_get_inode(dir->i_sb, mode);
|
||||
if (!inode)
|
||||
return -ENOMEM;
|
||||
if (ncl) {
|
||||
inode->i_private = ncl;
|
||||
kref_get(&ncl->cl_ref);
|
||||
}
|
||||
d_add(dentry, inode);
|
||||
inc_nlink(dir);
|
||||
fsnotify_mkdir(dir, dentry);
|
||||
@ -1194,17 +1198,14 @@ static struct dentry *nfsd_mkdir(struct dentry *parent, struct nfsdfs_client *nc
|
||||
dentry = d_alloc_name(parent, name);
|
||||
if (!dentry)
|
||||
goto out_err;
|
||||
ret = __nfsd_mkdir(d_inode(parent), dentry, S_IFDIR | 0600);
|
||||
ret = __nfsd_mkdir(d_inode(parent), dentry, S_IFDIR | 0600, ncl);
|
||||
if (ret)
|
||||
goto out_err;
|
||||
if (ncl) {
|
||||
d_inode(dentry)->i_private = ncl;
|
||||
kref_get(&ncl->cl_ref);
|
||||
}
|
||||
out:
|
||||
inode_unlock(dir);
|
||||
return dentry;
|
||||
out_err:
|
||||
dput(dentry);
|
||||
dentry = ERR_PTR(ret);
|
||||
goto out;
|
||||
}
|
||||
@ -1214,11 +1215,9 @@ static void clear_ncl(struct inode *inode)
|
||||
struct nfsdfs_client *ncl = inode->i_private;
|
||||
|
||||
inode->i_private = NULL;
|
||||
synchronize_rcu();
|
||||
kref_put(&ncl->cl_ref, ncl->cl_release);
|
||||
}
|
||||
|
||||
|
||||
static struct nfsdfs_client *__get_nfsdfs_client(struct inode *inode)
|
||||
{
|
||||
struct nfsdfs_client *nc = inode->i_private;
|
||||
@ -1232,9 +1231,9 @@ struct nfsdfs_client *get_nfsdfs_client(struct inode *inode)
|
||||
{
|
||||
struct nfsdfs_client *nc;
|
||||
|
||||
rcu_read_lock();
|
||||
inode_lock_shared(inode);
|
||||
nc = __get_nfsdfs_client(inode);
|
||||
rcu_read_unlock();
|
||||
inode_unlock_shared(inode);
|
||||
return nc;
|
||||
}
|
||||
/* from __rpc_unlink */
|
||||
|
Loading…
Reference in New Issue
Block a user