Commit 69049961 authored by Andi Kleen's avatar Andi Kleen Committed by J. Bruce Fields

gcc-4.6: nfsd: fix initialized but not read warnings

Fixes at least one real minor bug: the nfs4 recovery dir sysctl
would not return its status properly.

Also I finished Al's 1e41568d ("Take ima_path_check() in nfsd
past dentry_open() in nfsd_open()") commit, it moved the IMA
code, but left the old path initializer in there.

The rest is just dead code removed I think, although I was not
fully sure about the "is_borc" stuff. Some more review
would be still good.

Found by gcc 4.6's new warnings.
Signed-off-by: default avatarAndi Kleen <ak@linux.intel.com>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: Neil Brown <neilb@suse.de>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarJ. Bruce Fields <bfields@redhat.com>
parent f9d7562f
...@@ -3421,11 +3421,9 @@ static inline void ...@@ -3421,11 +3421,9 @@ static inline void
nfs4_set_lock_denied(struct file_lock *fl, struct nfsd4_lock_denied *deny) nfs4_set_lock_denied(struct file_lock *fl, struct nfsd4_lock_denied *deny)
{ {
struct nfs4_stateowner *sop; struct nfs4_stateowner *sop;
unsigned int hval;
if (fl->fl_lmops == &nfsd_posix_mng_ops) { if (fl->fl_lmops == &nfsd_posix_mng_ops) {
sop = (struct nfs4_stateowner *) fl->fl_owner; sop = (struct nfs4_stateowner *) fl->fl_owner;
hval = lockownerid_hashval(sop->so_id);
kref_get(&sop->so_ref); kref_get(&sop->so_ref);
deny->ld_sop = sop; deny->ld_sop = sop;
deny->ld_clientid = sop->so_client->cl_clientid; deny->ld_clientid = sop->so_client->cl_clientid;
......
...@@ -1306,6 +1306,8 @@ static ssize_t __write_recoverydir(struct file *file, char *buf, size_t size) ...@@ -1306,6 +1306,8 @@ static ssize_t __write_recoverydir(struct file *file, char *buf, size_t size)
return -EINVAL; return -EINVAL;
status = nfs4_reset_recoverydir(recdir); status = nfs4_reset_recoverydir(recdir);
if (status)
return status;
} }
return scnprintf(buf, SIMPLE_TRANSACTION_LIMIT, "%s\n", return scnprintf(buf, SIMPLE_TRANSACTION_LIMIT, "%s\n",
......
...@@ -290,7 +290,6 @@ nfsd_proc_create(struct svc_rqst *rqstp, struct nfsd_createargs *argp, ...@@ -290,7 +290,6 @@ nfsd_proc_create(struct svc_rqst *rqstp, struct nfsd_createargs *argp,
* gospel of sun micro * gospel of sun micro
*/ */
if (type != S_IFREG) { if (type != S_IFREG) {
int is_borc = 0;
if (type != S_IFBLK && type != S_IFCHR) { if (type != S_IFBLK && type != S_IFCHR) {
rdev = 0; rdev = 0;
} else if (type == S_IFCHR && !(attr->ia_valid & ATTR_SIZE)) { } else if (type == S_IFCHR && !(attr->ia_valid & ATTR_SIZE)) {
...@@ -298,7 +297,6 @@ nfsd_proc_create(struct svc_rqst *rqstp, struct nfsd_createargs *argp, ...@@ -298,7 +297,6 @@ nfsd_proc_create(struct svc_rqst *rqstp, struct nfsd_createargs *argp,
type = S_IFIFO; type = S_IFIFO;
} else { } else {
/* Okay, char or block special */ /* Okay, char or block special */
is_borc = 1;
if (!rdev) if (!rdev)
rdev = wanted; rdev = wanted;
} }
......
...@@ -2052,7 +2052,6 @@ nfsd_permission(struct svc_rqst *rqstp, struct svc_export *exp, ...@@ -2052,7 +2052,6 @@ nfsd_permission(struct svc_rqst *rqstp, struct svc_export *exp,
struct dentry *dentry, int acc) struct dentry *dentry, int acc)
{ {
struct inode *inode = dentry->d_inode; struct inode *inode = dentry->d_inode;
struct path path;
int err; int err;
if (acc == NFSD_MAY_NOP) if (acc == NFSD_MAY_NOP)
...@@ -2125,15 +2124,7 @@ nfsd_permission(struct svc_rqst *rqstp, struct svc_export *exp, ...@@ -2125,15 +2124,7 @@ nfsd_permission(struct svc_rqst *rqstp, struct svc_export *exp,
if (err == -EACCES && S_ISREG(inode->i_mode) && if (err == -EACCES && S_ISREG(inode->i_mode) &&
acc == (NFSD_MAY_READ | NFSD_MAY_OWNER_OVERRIDE)) acc == (NFSD_MAY_READ | NFSD_MAY_OWNER_OVERRIDE))
err = inode_permission(inode, MAY_EXEC); err = inode_permission(inode, MAY_EXEC);
if (err)
goto nfsd_out;
/* Do integrity (permission) checking now, but defer incrementing
* IMA counts to the actual file open.
*/
path.mnt = exp->ex_path.mnt;
path.dentry = dentry;
nfsd_out:
return err? nfserrno(err) : 0; return err? nfserrno(err) : 0;
} }
......
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