Commit 410520d0 authored by Linus Torvalds's avatar Linus Torvalds

Merge tag '9p-for-5.9-rc1' of git://github.com/martinetd/linux

Pull 9p updates from Dominique Martinet:

 - some code cleanup

 - a couple of static analysis fixes

 - setattr: try to pick a fid associated with the file rather than the
   dentry, which might sometimes matter

* tag '9p-for-5.9-rc1' of git://github.com/martinetd/linux:
  9p: Remove unneeded cast from memory allocation
  9p: remove unused code in 9p
  net/9p: Fix sparse endian warning in trans_fd.c
  9p: Fix memory leak in v9fs_mount
  9p: retrieve fid from file when file instance exist.
parents f6513bd3 2ed0b757
...@@ -500,10 +500,9 @@ void v9fs_session_close(struct v9fs_session_info *v9ses) ...@@ -500,10 +500,9 @@ void v9fs_session_close(struct v9fs_session_info *v9ses)
} }
#ifdef CONFIG_9P_FSCACHE #ifdef CONFIG_9P_FSCACHE
if (v9ses->fscache) { if (v9ses->fscache)
v9fs_cache_session_put_cookie(v9ses); v9fs_cache_session_put_cookie(v9ses);
kfree(v9ses->cachetag); kfree(v9ses->cachetag);
}
#endif #endif
kfree(v9ses->uname); kfree(v9ses->uname);
kfree(v9ses->aname); kfree(v9ses->aname);
......
...@@ -223,8 +223,7 @@ v9fs_blank_wstat(struct p9_wstat *wstat) ...@@ -223,8 +223,7 @@ v9fs_blank_wstat(struct p9_wstat *wstat)
struct inode *v9fs_alloc_inode(struct super_block *sb) struct inode *v9fs_alloc_inode(struct super_block *sb)
{ {
struct v9fs_inode *v9inode; struct v9fs_inode *v9inode;
v9inode = (struct v9fs_inode *)kmem_cache_alloc(v9fs_inode_cache, v9inode = kmem_cache_alloc(v9fs_inode_cache, GFP_KERNEL);
GFP_KERNEL);
if (!v9inode) if (!v9inode)
return NULL; return NULL;
#ifdef CONFIG_9P_FSCACHE #ifdef CONFIG_9P_FSCACHE
...@@ -368,59 +367,6 @@ struct inode *v9fs_get_inode(struct super_block *sb, umode_t mode, dev_t rdev) ...@@ -368,59 +367,6 @@ struct inode *v9fs_get_inode(struct super_block *sb, umode_t mode, dev_t rdev)
return inode; return inode;
} }
/*
static struct v9fs_fid*
v9fs_clone_walk(struct v9fs_session_info *v9ses, u32 fid, struct dentry *dentry)
{
int err;
int nfid;
struct v9fs_fid *ret;
struct v9fs_fcall *fcall;
nfid = v9fs_get_idpool(&v9ses->fidpool);
if (nfid < 0) {
eprintk(KERN_WARNING, "no free fids available\n");
return ERR_PTR(-ENOSPC);
}
err = v9fs_t_walk(v9ses, fid, nfid, (char *) dentry->d_name.name,
&fcall);
if (err < 0) {
if (fcall && fcall->id == RWALK)
goto clunk_fid;
PRINT_FCALL_ERROR("walk error", fcall);
v9fs_put_idpool(nfid, &v9ses->fidpool);
goto error;
}
kfree(fcall);
fcall = NULL;
ret = v9fs_fid_create(v9ses, nfid);
if (!ret) {
err = -ENOMEM;
goto clunk_fid;
}
err = v9fs_fid_insert(ret, dentry);
if (err < 0) {
v9fs_fid_destroy(ret);
goto clunk_fid;
}
return ret;
clunk_fid:
v9fs_t_clunk(v9ses, nfid);
error:
kfree(fcall);
return ERR_PTR(err);
}
*/
/** /**
* v9fs_clear_inode - release an inode * v9fs_clear_inode - release an inode
* @inode: inode to release * @inode: inode to release
...@@ -1090,7 +1036,7 @@ static int v9fs_vfs_setattr(struct dentry *dentry, struct iattr *iattr) ...@@ -1090,7 +1036,7 @@ static int v9fs_vfs_setattr(struct dentry *dentry, struct iattr *iattr)
{ {
int retval; int retval;
struct v9fs_session_info *v9ses; struct v9fs_session_info *v9ses;
struct p9_fid *fid; struct p9_fid *fid = NULL;
struct p9_wstat wstat; struct p9_wstat wstat;
p9_debug(P9_DEBUG_VFS, "\n"); p9_debug(P9_DEBUG_VFS, "\n");
...@@ -1100,6 +1046,11 @@ static int v9fs_vfs_setattr(struct dentry *dentry, struct iattr *iattr) ...@@ -1100,6 +1046,11 @@ static int v9fs_vfs_setattr(struct dentry *dentry, struct iattr *iattr)
retval = -EPERM; retval = -EPERM;
v9ses = v9fs_dentry2v9ses(dentry); v9ses = v9fs_dentry2v9ses(dentry);
if (iattr->ia_valid & ATTR_FILE) {
fid = iattr->ia_file->private_data;
WARN_ON(!fid);
}
if (!fid)
fid = v9fs_fid_lookup(dentry); fid = v9fs_fid_lookup(dentry);
if(IS_ERR(fid)) if(IS_ERR(fid))
return PTR_ERR(fid); return PTR_ERR(fid);
......
...@@ -540,7 +540,7 @@ static int v9fs_mapped_iattr_valid(int iattr_valid) ...@@ -540,7 +540,7 @@ static int v9fs_mapped_iattr_valid(int iattr_valid)
int v9fs_vfs_setattr_dotl(struct dentry *dentry, struct iattr *iattr) int v9fs_vfs_setattr_dotl(struct dentry *dentry, struct iattr *iattr)
{ {
int retval; int retval;
struct p9_fid *fid; struct p9_fid *fid = NULL;
struct p9_iattr_dotl p9attr; struct p9_iattr_dotl p9attr;
struct inode *inode = d_inode(dentry); struct inode *inode = d_inode(dentry);
...@@ -560,6 +560,11 @@ int v9fs_vfs_setattr_dotl(struct dentry *dentry, struct iattr *iattr) ...@@ -560,6 +560,11 @@ int v9fs_vfs_setattr_dotl(struct dentry *dentry, struct iattr *iattr)
p9attr.mtime_sec = iattr->ia_mtime.tv_sec; p9attr.mtime_sec = iattr->ia_mtime.tv_sec;
p9attr.mtime_nsec = iattr->ia_mtime.tv_nsec; p9attr.mtime_nsec = iattr->ia_mtime.tv_nsec;
if (iattr->ia_valid & ATTR_FILE) {
fid = iattr->ia_file->private_data;
WARN_ON(!fid);
}
if (!fid)
fid = v9fs_fid_lookup(dentry); fid = v9fs_fid_lookup(dentry);
if (IS_ERR(fid)) if (IS_ERR(fid))
return PTR_ERR(fid); return PTR_ERR(fid);
......
...@@ -950,7 +950,7 @@ static int p9_bind_privport(struct socket *sock) ...@@ -950,7 +950,7 @@ static int p9_bind_privport(struct socket *sock)
memset(&cl, 0, sizeof(cl)); memset(&cl, 0, sizeof(cl));
cl.sin_family = AF_INET; cl.sin_family = AF_INET;
cl.sin_addr.s_addr = INADDR_ANY; cl.sin_addr.s_addr = htonl(INADDR_ANY);
for (port = p9_ipport_resv_max; port >= p9_ipport_resv_min; port--) { for (port = p9_ipport_resv_max; port >= p9_ipport_resv_min; port--) {
cl.sin_port = htons((ushort)port); cl.sin_port = htons((ushort)port);
err = kernel_bind(sock, (struct sockaddr *)&cl, sizeof(cl)); err = kernel_bind(sock, (struct sockaddr *)&cl, sizeof(cl));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment