Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3e1f900b authored by Linus Torvalds's avatar Linus Torvalds
Browse files
* 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
parents 12795067 0a87cf12
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -1674,7 +1674,7 @@ config NFSD_V3_ACL


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


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


@@ -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);
	status = encode_attr_mtime(xdr, res->bitmap, &res->mtime);
	*savep = htonl((unsigned int)((char *)xdr->p - (char *)(savep+1)));
	*savep = htonl((unsigned int)((char *)xdr->p - (char *)(savep+1)));
out:
out:
	dprintk("%s: exit with status = %d\n", __FUNCTION__, status);
	dprintk("%s: exit with status = %d\n", __FUNCTION__, ntohl(status));
	return status;
	return status;
}
}


@@ -392,7 +392,7 @@ static __be32 process_op(struct svc_rqst *rqstp,
		status = res;
		status = res;
	if (op->encode_res != NULL && status == 0)
	if (op->encode_res != NULL && status == 0)
		status = op->encode_res(rqstp, xdr_out, resp);
		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;
	return status;
}
}


@@ -431,7 +431,7 @@ static __be32 nfs4_callback_compound(struct svc_rqst *rqstp, void *argp, void *r
	}
	}
	*hdr_res.status = status;
	*hdr_res.status = status;
	*hdr_res.nops = htonl(nops);
	*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;
	return rpc_success;
}
}


+4 −4
Original line number Original line Diff line number Diff line
@@ -654,7 +654,7 @@ static int nfs_check_verifier(struct inode *dir, struct dentry *dentry)


	if (IS_ROOT(dentry))
	if (IS_ROOT(dentry))
		return 1;
		return 1;
	verf = (unsigned long)dentry->d_fsdata;
	verf = dentry->d_time;
	if (nfs_caches_unstable(dir)
	if (nfs_caches_unstable(dir)
			|| verf != NFS_I(dir)->cache_change_attribute)
			|| verf != NFS_I(dir)->cache_change_attribute)
		return 0;
		return 0;
@@ -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)
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)
static void nfs_refresh_verifier(struct dentry * dentry, unsigned long verf)
@@ -869,7 +869,7 @@ static void nfs_dentry_iput(struct dentry *dentry, struct inode *inode)
	if (dentry->d_flags & DCACHE_NFSFS_RENAMED) {
	if (dentry->d_flags & DCACHE_NFSFS_RENAMED) {
		lock_kernel();
		lock_kernel();
		drop_nlink(inode);
		drop_nlink(inode);
		nfs_complete_unlink(dentry);
		nfs_complete_unlink(dentry, inode);
		unlock_kernel();
		unlock_kernel();
	}
	}
	/* When creating a negative dentry, we want to renew d_time */
	/* When creating a negative dentry, we want to renew d_time */
@@ -1411,7 +1411,7 @@ static int nfs_sillyrename(struct inode *dir, struct dentry *dentry)
		nfs_renew_times(dentry);
		nfs_renew_times(dentry);
		nfs_set_verifier(dentry, nfs_save_change_attribute(dir));
		nfs_set_verifier(dentry, nfs_save_change_attribute(dir));
		d_move(dentry, sdentry);
		d_move(dentry, sdentry);
		error = nfs_async_unlink(dentry);
		error = nfs_async_unlink(dir, dentry);
 		/* If we return 0 we don't unlink */
 		/* If we return 0 we don't unlink */
	}
	}
	dput(sdentry);
	dput(sdentry);
+16 −3
Original line number Original line Diff line number Diff line
@@ -43,6 +43,7 @@
#define NFS_entry_sz		(NFS_filename_sz+3)
#define NFS_entry_sz		(NFS_filename_sz+3)


#define NFS_diropargs_sz	(NFS_fhandle_sz+NFS_filename_sz)
#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_sattrargs_sz	(NFS_fhandle_sz+NFS_sattr_sz)
#define NFS_readlinkargs_sz	(NFS_fhandle_sz)
#define NFS_readlinkargs_sz	(NFS_fhandle_sz)
#define NFS_readargs_sz		(NFS_fhandle_sz+3)
#define NFS_readargs_sz		(NFS_fhandle_sz+3)
@@ -66,7 +67,7 @@
 * Common NFS XDR functions as inlines
 * Common NFS XDR functions as inlines
 */
 */
static inline __be32 *
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);
	memcpy(p, fhandle->data, NFS2_FHSIZE);
	return p + XDR_QUADLEN(NFS2_FHSIZE);
	return p + XDR_QUADLEN(NFS2_FHSIZE);
@@ -204,7 +205,7 @@ nfs_xdr_sattrargs(struct rpc_rqst *req, __be32 *p, struct nfs_sattrargs *args)


/*
/*
 * Encode directory ops argument
 * Encode directory ops argument
 * LOOKUP, REMOVE, RMDIR
 * LOOKUP, RMDIR
 */
 */
static int
static int
nfs_xdr_diropargs(struct rpc_rqst *req, __be32 *p, struct nfs_diropargs *args)
nfs_xdr_diropargs(struct rpc_rqst *req, __be32 *p, struct nfs_diropargs *args)
@@ -215,6 +216,18 @@ nfs_xdr_diropargs(struct rpc_rqst *req, __be32 *p, struct nfs_diropargs *args)
	return 0;
	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
 * 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
 * cache, we also set up the reply iovec here so that iov[1] points
@@ -705,7 +718,7 @@ struct rpc_procinfo nfs_procedures[] = {
    PROC(READ,		readargs,	readres, 3),
    PROC(READ,		readargs,	readres, 3),
    PROC(WRITE,		writeargs,	writeres, 4),
    PROC(WRITE,		writeargs,	writeres, 4),
    PROC(CREATE,	createargs,	diropres, 0),
    PROC(CREATE,	createargs,	diropres, 0),
    PROC(REMOVE,	diropargs,	stat, 0),
    PROC(REMOVE,	removeargs,	stat, 0),
    PROC(RENAME,	renameargs,	stat, 0),
    PROC(RENAME,	renameargs,	stat, 0),
    PROC(LINK,		linkargs,	stat, 0),
    PROC(LINK,		linkargs,	stat, 0),
    PROC(SYMLINK,	symlinkargs,	stat, 0),
    PROC(SYMLINK,	symlinkargs,	stat, 0),
+20 −40
Original line number Original line Diff line number Diff line
@@ -349,62 +349,42 @@ nfs3_proc_create(struct inode *dir, struct dentry *dentry, struct iattr *sattr,
static int
static int
nfs3_proc_remove(struct inode *dir, struct qstr *name)
nfs3_proc_remove(struct inode *dir, struct qstr *name)
{
{
	struct nfs_fattr	dir_attr;
	struct nfs_removeargs arg = {
	struct nfs3_diropargs	arg = {
		.fh = NFS_FH(dir),
		.fh = NFS_FH(dir),
		.name		= name->name,
		.name.len = name->len,
		.len		= name->len
		.name.name = name->name,
	};
	};
	struct nfs_removeres res;
	struct rpc_message msg = {
	struct rpc_message msg = {
		.rpc_proc = &nfs3_procedures[NFS3PROC_REMOVE],
		.rpc_proc = &nfs3_procedures[NFS3PROC_REMOVE],
		.rpc_argp = &arg,
		.rpc_argp = &arg,
		.rpc_resp	= &dir_attr,
		.rpc_resp = &res,
	};
	};
	int			status;
	int			status;


	dprintk("NFS call  remove %s\n", name->name);
	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);
	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);
	dprintk("NFS reply remove: %d\n", status);
	return status;
	return status;
}
}


static int
static void
nfs3_proc_unlink_setup(struct rpc_message *msg, struct dentry *dir, struct qstr *name)
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_proc = &nfs3_procedures[NFS3PROC_REMOVE];
	msg->rpc_argp = &ptr->arg;
	msg->rpc_resp = &ptr->res;
	return 0;
}
}


static int
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_removeres *res;
	struct nfs_fattr	*dir_attr;
	if (nfs3_async_handle_jukebox(task, dir))

	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;
		return 0;
	res = task->tk_msg.rpc_resp;
	nfs_post_op_update_inode(dir, &res->dir_attr);
	return 1;
}
}


static int
static int
Loading