Skip to content

Commit

Permalink
Merge git://git.linux-nfs.org/pub/linux/nfs-2.6
Browse files Browse the repository at this point in the history
* git://git.linux-nfs.org/pub/linux/nfs-2.6:
  NFSv4: handle lack of clientaddr in option string
  NFSv4: debug print ntohl(status) in nfs client callback xdr code
  SUNRPC: Clean up the sillyrename code
  NFS: Introduce struct nfs_removeargs+nfs_removeres
  NFS: Use dentry->d_time to store the parent directory verifier.
  SUNRPC: move bkl locking and xdr proc invocation into a common helper
  NFSv4: Fix the nfsv4 readlink reply buffer alignment
  NFSv4: Fix the readdir reply buffer alignment
  NFSv4: More NFSv4 xdr cleanups
  NFSv4: Try to recover from getfh failures in nfs4_xdr_dec_open
  NFSv4: 'constify' lookup arguments.
  NFSv4: Don't fail nfs4_xdr_dec_open if decode_restorefh() failed
  NFSv4: Fix open state recovery
  NFSD/SUNRPC: Fix the automatic selection of RPCSEC_GSS
  • Loading branch information
Linus Torvalds committed Jul 19, 2007
2 parents 1279506 + 0a87cf1 commit 3e1f900
Show file tree
Hide file tree
Showing 17 changed files with 442 additions and 407 deletions.
2 changes: 1 addition & 1 deletion fs/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -1674,7 +1674,7 @@ config NFSD_V3_ACL

config NFSD_V4
bool "Provide NFSv4 server support (EXPERIMENTAL)"
depends on NFSD_V3 && EXPERIMENTAL
depends on NFSD && NFSD_V3 && EXPERIMENTAL
select RPCSEC_GSS_KRB5
help
If you would like to include the NFSv4 server as well as the NFSv2
Expand Down
10 changes: 5 additions & 5 deletions fs/nfs/callback_xdr.c
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ static __be32 decode_getattr_args(struct svc_rqst *rqstp, struct xdr_stream *xdr
args->addr = svc_addr_in(rqstp);
status = decode_bitmap(xdr, args->bitmap);
out:
dprintk("%s: exit with status = %d\n", __FUNCTION__, status);
dprintk("%s: exit with status = %d\n", __FUNCTION__, ntohl(status));
return status;
}

Expand All @@ -200,7 +200,7 @@ static __be32 decode_recall_args(struct svc_rqst *rqstp, struct xdr_stream *xdr,
args->truncate = ntohl(*p);
status = decode_fh(xdr, &args->fh);
out:
dprintk("%s: exit with status = %d\n", __FUNCTION__, status);
dprintk("%s: exit with status = %d\n", __FUNCTION__, ntohl(status));
return status;
}

Expand Down Expand Up @@ -349,7 +349,7 @@ static __be32 encode_getattr_res(struct svc_rqst *rqstp, struct xdr_stream *xdr,
status = encode_attr_mtime(xdr, res->bitmap, &res->mtime);
*savep = htonl((unsigned int)((char *)xdr->p - (char *)(savep+1)));
out:
dprintk("%s: exit with status = %d\n", __FUNCTION__, status);
dprintk("%s: exit with status = %d\n", __FUNCTION__, ntohl(status));
return status;
}

Expand Down Expand Up @@ -392,7 +392,7 @@ static __be32 process_op(struct svc_rqst *rqstp,
status = res;
if (op->encode_res != NULL && status == 0)
status = op->encode_res(rqstp, xdr_out, resp);
dprintk("%s: done, status = %d\n", __FUNCTION__, status);
dprintk("%s: done, status = %d\n", __FUNCTION__, ntohl(status));
return status;
}

Expand Down Expand Up @@ -431,7 +431,7 @@ static __be32 nfs4_callback_compound(struct svc_rqst *rqstp, void *argp, void *r
}
*hdr_res.status = status;
*hdr_res.nops = htonl(nops);
dprintk("%s: done, status = %u\n", __FUNCTION__, status);
dprintk("%s: done, status = %u\n", __FUNCTION__, ntohl(status));
return rpc_success;
}

Expand Down
8 changes: 4 additions & 4 deletions fs/nfs/dir.c
Original file line number Diff line number Diff line change
Expand Up @@ -654,7 +654,7 @@ static int nfs_check_verifier(struct inode *dir, struct dentry *dentry)

if (IS_ROOT(dentry))
return 1;
verf = (unsigned long)dentry->d_fsdata;
verf = dentry->d_time;
if (nfs_caches_unstable(dir)
|| verf != NFS_I(dir)->cache_change_attribute)
return 0;
Expand All @@ -663,7 +663,7 @@ static int nfs_check_verifier(struct inode *dir, struct dentry *dentry)

static inline void nfs_set_verifier(struct dentry * dentry, unsigned long verf)
{
dentry->d_fsdata = (void *)verf;
dentry->d_time = verf;
}

static void nfs_refresh_verifier(struct dentry * dentry, unsigned long verf)
Expand Down Expand Up @@ -869,7 +869,7 @@ static void nfs_dentry_iput(struct dentry *dentry, struct inode *inode)
if (dentry->d_flags & DCACHE_NFSFS_RENAMED) {
lock_kernel();
drop_nlink(inode);
nfs_complete_unlink(dentry);
nfs_complete_unlink(dentry, inode);
unlock_kernel();
}
/* When creating a negative dentry, we want to renew d_time */
Expand Down Expand Up @@ -1411,7 +1411,7 @@ static int nfs_sillyrename(struct inode *dir, struct dentry *dentry)
nfs_renew_times(dentry);
nfs_set_verifier(dentry, nfs_save_change_attribute(dir));
d_move(dentry, sdentry);
error = nfs_async_unlink(dentry);
error = nfs_async_unlink(dir, dentry);
/* If we return 0 we don't unlink */
}
dput(sdentry);
Expand Down
19 changes: 16 additions & 3 deletions fs/nfs/nfs2xdr.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
#define NFS_entry_sz (NFS_filename_sz+3)

#define NFS_diropargs_sz (NFS_fhandle_sz+NFS_filename_sz)
#define NFS_removeargs_sz (NFS_fhandle_sz+NFS_filename_sz)
#define NFS_sattrargs_sz (NFS_fhandle_sz+NFS_sattr_sz)
#define NFS_readlinkargs_sz (NFS_fhandle_sz)
#define NFS_readargs_sz (NFS_fhandle_sz+3)
Expand All @@ -66,7 +67,7 @@
* Common NFS XDR functions as inlines
*/
static inline __be32 *
xdr_encode_fhandle(__be32 *p, struct nfs_fh *fhandle)
xdr_encode_fhandle(__be32 *p, const struct nfs_fh *fhandle)
{
memcpy(p, fhandle->data, NFS2_FHSIZE);
return p + XDR_QUADLEN(NFS2_FHSIZE);
Expand Down Expand Up @@ -204,7 +205,7 @@ nfs_xdr_sattrargs(struct rpc_rqst *req, __be32 *p, struct nfs_sattrargs *args)

/*
* Encode directory ops argument
* LOOKUP, REMOVE, RMDIR
* LOOKUP, RMDIR
*/
static int
nfs_xdr_diropargs(struct rpc_rqst *req, __be32 *p, struct nfs_diropargs *args)
Expand All @@ -215,6 +216,18 @@ nfs_xdr_diropargs(struct rpc_rqst *req, __be32 *p, struct nfs_diropargs *args)
return 0;
}

/*
* Encode REMOVE argument
*/
static int
nfs_xdr_removeargs(struct rpc_rqst *req, __be32 *p, const struct nfs_removeargs *args)
{
p = xdr_encode_fhandle(p, args->fh);
p = xdr_encode_array(p, args->name.name, args->name.len);
req->rq_slen = xdr_adjust_iovec(req->rq_svec, p);
return 0;
}

/*
* Arguments to a READ call. Since we read data directly into the page
* cache, we also set up the reply iovec here so that iov[1] points
Expand Down Expand Up @@ -705,7 +718,7 @@ struct rpc_procinfo nfs_procedures[] = {
PROC(READ, readargs, readres, 3),
PROC(WRITE, writeargs, writeres, 4),
PROC(CREATE, createargs, diropres, 0),
PROC(REMOVE, diropargs, stat, 0),
PROC(REMOVE, removeargs, stat, 0),
PROC(RENAME, renameargs, stat, 0),
PROC(LINK, linkargs, stat, 0),
PROC(SYMLINK, symlinkargs, stat, 0),
Expand Down
60 changes: 20 additions & 40 deletions fs/nfs/nfs3proc.c
Original file line number Diff line number Diff line change
Expand Up @@ -349,62 +349,42 @@ nfs3_proc_create(struct inode *dir, struct dentry *dentry, struct iattr *sattr,
static int
nfs3_proc_remove(struct inode *dir, struct qstr *name)
{
struct nfs_fattr dir_attr;
struct nfs3_diropargs arg = {
.fh = NFS_FH(dir),
.name = name->name,
.len = name->len
struct nfs_removeargs arg = {
.fh = NFS_FH(dir),
.name.len = name->len,
.name.name = name->name,
};
struct rpc_message msg = {
.rpc_proc = &nfs3_procedures[NFS3PROC_REMOVE],
.rpc_argp = &arg,
.rpc_resp = &dir_attr,
struct nfs_removeres res;
struct rpc_message msg = {
.rpc_proc = &nfs3_procedures[NFS3PROC_REMOVE],
.rpc_argp = &arg,
.rpc_resp = &res,
};
int status;

dprintk("NFS call remove %s\n", name->name);
nfs_fattr_init(&dir_attr);
nfs_fattr_init(&res.dir_attr);
status = rpc_call_sync(NFS_CLIENT(dir), &msg, 0);
nfs_post_op_update_inode(dir, &dir_attr);
nfs_post_op_update_inode(dir, &res.dir_attr);
dprintk("NFS reply remove: %d\n", status);
return status;
}

static int
nfs3_proc_unlink_setup(struct rpc_message *msg, struct dentry *dir, struct qstr *name)
static void
nfs3_proc_unlink_setup(struct rpc_message *msg, struct inode *dir)
{
struct unlinkxdr {
struct nfs3_diropargs arg;
struct nfs_fattr res;
} *ptr;

ptr = kmalloc(sizeof(*ptr), GFP_KERNEL);
if (!ptr)
return -ENOMEM;
ptr->arg.fh = NFS_FH(dir->d_inode);
ptr->arg.name = name->name;
ptr->arg.len = name->len;
nfs_fattr_init(&ptr->res);
msg->rpc_proc = &nfs3_procedures[NFS3PROC_REMOVE];
msg->rpc_argp = &ptr->arg;
msg->rpc_resp = &ptr->res;
return 0;
}

static int
nfs3_proc_unlink_done(struct dentry *dir, struct rpc_task *task)
nfs3_proc_unlink_done(struct rpc_task *task, struct inode *dir)
{
struct rpc_message *msg = &task->tk_msg;
struct nfs_fattr *dir_attr;

if (nfs3_async_handle_jukebox(task, dir->d_inode))
return 1;
if (msg->rpc_argp) {
dir_attr = (struct nfs_fattr*)msg->rpc_resp;
nfs_post_op_update_inode(dir->d_inode, dir_attr);
kfree(msg->rpc_argp);
}
return 0;
struct nfs_removeres *res;
if (nfs3_async_handle_jukebox(task, dir))
return 0;
res = task->tk_msg.rpc_resp;
nfs_post_op_update_inode(dir, &res->dir_attr);
return 1;
}

static int
Expand Down
24 changes: 22 additions & 2 deletions fs/nfs/nfs3xdr.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@

#define NFS3_sattrargs_sz (NFS3_fh_sz+NFS3_sattr_sz+3)
#define NFS3_diropargs_sz (NFS3_fh_sz+NFS3_filename_sz)
#define NFS3_removeargs_sz (NFS3_fh_sz+NFS3_filename_sz)
#define NFS3_accessargs_sz (NFS3_fh_sz+1)
#define NFS3_readlinkargs_sz (NFS3_fh_sz)
#define NFS3_readargs_sz (NFS3_fh_sz+3)
Expand All @@ -65,6 +66,7 @@

#define NFS3_attrstat_sz (1+NFS3_fattr_sz)
#define NFS3_wccstat_sz (1+NFS3_wcc_data_sz)
#define NFS3_removeres_sz (NFS3_wccstat_sz)
#define NFS3_lookupres_sz (1+NFS3_fh_sz+(2 * NFS3_post_op_attr_sz))
#define NFS3_accessres_sz (1+NFS3_post_op_attr_sz+1)
#define NFS3_readlinkres_sz (1+NFS3_post_op_attr_sz+1)
Expand Down Expand Up @@ -106,7 +108,7 @@ static struct {
* Common NFS XDR functions as inlines
*/
static inline __be32 *
xdr_encode_fhandle(__be32 *p, struct nfs_fh *fh)
xdr_encode_fhandle(__be32 *p, const struct nfs_fh *fh)
{
return xdr_encode_array(p, fh->data, fh->size);
}
Expand Down Expand Up @@ -299,6 +301,18 @@ nfs3_xdr_diropargs(struct rpc_rqst *req, __be32 *p, struct nfs3_diropargs *args)
return 0;
}

/*
* Encode REMOVE argument
*/
static int
nfs3_xdr_removeargs(struct rpc_rqst *req, __be32 *p, const struct nfs_removeargs *args)
{
p = xdr_encode_fhandle(p, args->fh);
p = xdr_encode_array(p, args->name.name, args->name.len);
req->rq_slen = xdr_adjust_iovec(req->rq_svec, p);
return 0;
}

/*
* Encode access() argument
*/
Expand Down Expand Up @@ -736,6 +750,12 @@ nfs3_xdr_wccstat(struct rpc_rqst *req, __be32 *p, struct nfs_fattr *fattr)
return status;
}

static int
nfs3_xdr_removeres(struct rpc_rqst *req, __be32 *p, struct nfs_removeres *res)
{
return nfs3_xdr_wccstat(req, p, &res->dir_attr);
}

/*
* Decode LOOKUP reply
*/
Expand Down Expand Up @@ -1126,7 +1146,7 @@ struct rpc_procinfo nfs3_procedures[] = {
PROC(MKDIR, mkdirargs, createres, 0),
PROC(SYMLINK, symlinkargs, createres, 0),
PROC(MKNOD, mknodargs, createres, 0),
PROC(REMOVE, diropargs, wccstat, 0),
PROC(REMOVE, removeargs, removeres, 0),
PROC(RMDIR, diropargs, wccstat, 0),
PROC(RENAME, renameargs, renameres, 0),
PROC(LINK, linkargs, linkres, 0),
Expand Down
2 changes: 1 addition & 1 deletion fs/nfs/nfs4_fs.h
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ extern int nfs4_do_close(struct path *path, struct nfs4_state *state);
extern struct dentry *nfs4_atomic_open(struct inode *, struct dentry *, struct nameidata *);
extern int nfs4_open_revalidate(struct inode *, struct dentry *, int, struct nameidata *);
extern int nfs4_server_capabilities(struct nfs_server *server, struct nfs_fh *fhandle);
extern int nfs4_proc_fs_locations(struct inode *dir, struct qstr *name,
extern int nfs4_proc_fs_locations(struct inode *dir, const struct qstr *name,
struct nfs4_fs_locations *fs_locations, struct page *page);

extern struct nfs4_state_recovery_ops nfs4_reboot_recovery_ops;
Expand Down
Loading

0 comments on commit 3e1f900

Please sign in to comment.