[pnfs] 2.6-latest rebase
Benny Halevy
bhalevy at panasas.com
Tue Dec 11 04:22:41 EST 2007
I've completed rebasing our patches in the linux-pnfs-2.6 over 2.6.24-rc5
in git://bhalevy.com/linux-pnfs-bh in the rebase-chron branch
(or over gitweb in http://www.bhalevy.com/git/gitweb.cgi?p=linux-pnfs-bh/.git)
I've found and fixed a few bugs along the way, see details below...
This is untested yet, just verified against the master branch
with git-diff -w. The vast majority of the differences are style related.
Style: Please, please, PLEASE start using scripts/checkpatch.pl *before* submitting
patches to the tree. I don't understand why new code submitted in the 2.6-latest
tree wasn't coded in the linux kernel coding style and then there were later
patches to convert spaces to tabs, remove trailing space, etc. etc.
This just gave me a horrible headache to fix that so the code looks
sane, self-consistent WRT coding style and easily merge and rebase-able.
Let's stick to the Linux kernel coding style if we ever think of pushing upstream.
I called the branch rebase-chron as the patches are in chronological order.
Sometime soon I want to sort the patches and create a nfs41 (sessions)
branch and a pnfs branch, stacked (rebased) on top of it. Unlike what we had
in the 2.6.18.3 tree, when the respective patchsets are rebased one on top
of the other, keeping the branches in sync should be possible.
I split some existing patches that touched both subsystems to allow this but more
work is needed.
Naming convention: it was quite difficult to find our patches in the huge
linux hey stack since we had no naming convention for the patches, plus
the commit headers were screwed up in many cases when folks didn't insert
a blank line after the first line in the patch description. As a reminder,
the first line identifies the patch in most tools and keeping it short
is important for streamlining git-rebase--interactive.
[see also http://www.kernel.org/pub/software/scm/git/docs/user-manual.html#creating-good-commit-messages]
To help maintain the patches further I used nfs41: nfsd41: pnfs: and pnfsd: prefixes
to identify the appropriate subsystem. Let's try to keep that convention from now on
to make locating them in the crowd and sorting them easier. (I'm not married to
these specific names, although they make sense to me at least)
Bisectability: I checked that all patches compile (I checked most of them for
fs/nfs, fs/nfsd, and net/sunrpc). The relevant ones with CONFIG_PNFS defined
and undefined (need also to check with CONFIG_NFS{,D}_V4_1 undefined as well).
This required squashing several patches that fixed stuff into the original
patch they fixed. Ideally, in the future, all patches will be tested before
submit so they compile, run, and pass the relevant tests. If you submit
a patchset comprised of several patches, each one of them (cumulatively)
should be buildable so that if anything breaks we can find the specific
patch at blame, isolate it, and fix it.
Benny
--
fixes done on rebase to 2.6.24-rc5
master - 3d8c873a39ff5b497088b4ebc36dc1eb1b2c2623
2.6.24-rc5-nfs41-rebased 9b1f7b57cd323f45a0fcbd5ac3575266a083a83f
diff made using git-diff -w 3d8c873a39ff5b497088b4ebc36dc1eb1b2c2623
general fixes
-------------
diff --git a/Makefile b/Makefile
index c1825aa..a4ee102 100644
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,7 @@
VERSION = 2
PATCHLEVEL = 6
SUBLEVEL = 24
-EXTRAVERSION = -rc5
+EXTRAVERSION = -rc5-nfs41
NAME = Arr Matey! A Hairy Bilge Rat!
# *DOCUMENTATION*
Added extraversion, will add on for pnfs once separate branhces established
diff --git a/fs/nfs/Makefile b/fs/nfs/Makefile
index c71f4ee..81c8837 100644
--- a/fs/nfs/Makefile
+++ b/fs/nfs/Makefile
@@ -18,7 +18,6 @@ nfs-$(CONFIG_NFS_V4_1) += nfs41_session_recovery.o
nfs-$(CONFIG_PNFS) += pnfs.o
nfs-$(CONFIG_NFS_DIRECTIO) += direct.o
nfs-$(CONFIG_SYSCTL) += sysctl.o
-nfs-objs := $(nfs-y)
obj-m += nfslayoutdriver.o
nfslayoutdriver-objs := nfs4filelayout.o nfs4filelayoutdev.o
missing from master
diff --git a/include/linux/exportfs.h b/include/linux/exportfs.h
index af0855e..c93cf23 100644
--- a/include/linux/exportfs.h
+++ b/include/linux/exportfs.h
@@ -110,6 +110,7 @@ struct export_operations {
int (*get_name)(struct dentry *parent, char *name,
struct dentry *child);
struct dentry * (*get_parent)(struct dentry *child);
+#if defined(CONFIG_PNFS)
/* pNFS operations */
/* pNFS: returns the verifier */
void (*get_verifier) (struct super_block *sb, u32 *p);
@@ -144,7 +145,6 @@ struct export_operations {
/* pNFS: returns the layout */
int (*layout_return) (struct inode *inode, void *p);
-
/* callback from fs on MDS only */
int (*cb_get_state) (void *state);
int (*cb_layout_recall) (struct super_block *sb, struct inode *inode, void *p);
@@ -152,6 +152,7 @@ struct export_operations {
int (*get_state) (struct inode *inode, void *fh, void *state);
/* callback from fs on DS only */
int (*cb_change_state) (void *p);
+#endif /* CONFIG_PNFS */
};
extern int exportfs_encode_fh(struct dentry *dentry, struct fid *fid,
diff --git a/include/linux/nfs4_pnfs.h b/include/linux/nfs4_pnfs.h
index b59ee2b..c400d47 100644
--- a/include/linux/nfs4_pnfs.h
+++ b/include/linux/nfs4_pnfs.h
@@ -12,6 +12,8 @@
#ifndef LINUX_NFS4_PNFS_H
#define LINUX_NFS4_PNFS_H
+#if defined(CONFIG_PNFS)
+
#define NFS4_PNFS_DEV_MAXCOUNT 16
#define NFS4_PNFS_DEV_MAXSIZE 128
diff --git a/include/linux/nfsd/nfsd4_pnfs.h b/include/linux/nfsd/nfsd4_pnfs.h
index 0d119f3..b64f09f 100644
--- a/include/linux/nfsd/nfsd4_pnfs.h
+++ b/include/linux/nfsd/nfsd4_pnfs.h
@@ -36,6 +36,8 @@
#ifndef _LINUX_NFSD_NFSD4_PNFS_H
#define _LINUX_NFSD_NFSD4_PNFS_H
+#if defined(CONFIG_PNFS)
+
#include <linux/nfs.h>
#include <linux/nfs_xdr.h>
diff --git a/include/linux/nfsd/pnfsd.h b/include/linux/nfsd/pnfsd.h
index 373fc90..7f36011 100644
--- a/include/linux/nfsd/pnfsd.h
+++ b/include/linux/nfsd/pnfsd.h
@@ -33,6 +33,11 @@
*
*/
+#ifndef _LINUX_NFSD_PNFSD_H
+#define _LINUX_NFSD_PNFSD_H
+
+#if defined(CONFIG_PNFS)
+
#include <linux/nfsd/nfsd4_pnfs.h>
/* pNFS Metadata to Data server state communication*/
for compiling when !defined(CONFIG_PNFS)
diff --git a/include/linux/nfs4.h b/include/linux/nfs4.h
index 1ba5771..18d9264 100644
--- a/include/linux/nfs4.h
+++ b/include/linux/nfs4.h
@@ -109,6 +109,7 @@
#define EXCHGID4_FLAG_SUPP_MOVED_REFER 0x00000001
#define EXCHGID4_FLAG_SUPP_MOVED_MIGR 0x00000002
+#define EXCHGID4_FLAG_USE_NON_PNFS 0x00010000
#define EXCHGID4_FLAG_USE_PNFS_MDS 0x00020000
#define EXCHGID4_FLAG_USE_PNFS_DS 0x00040000
#define EXCHGID4_MFS_DS_FLAG_MASK 0x00060000
leave flag defined even if not used
diff --git a/include/linux/nfs_xdr.h b/include/linux/nfs_xdr.h
index b500710..e479fa7 100644
--- a/include/linux/nfs_xdr.h
+++ b/include/linux/nfs_xdr.h
@@ -986,12 +987,6 @@ struct nfs_impl_id4 {
struct nfstime4 date;
};
-#define EXCHGID4_FLAG_SUPP_MOVED_REFER 0x00000001
-#define EXCHGID4_FLAG_SUPP_MOVED_MIGR 0x00000002
-#define EXCHGID4_FLAG_USE_NON_PNFS 0x00010000
-#define EXCHGID4_FLAG_USE_PNFS_MDS 0x00020000
-#define EXCHGID4_FLAG_USE_PNFS_DS 0x00040000
-
struct nfs41_exchange_id_args {
nfs4_verifier * verifier;
unsigned int id_len;
delete redundant definitions (exist in include/linux/nfs4.h)
diff --git a/include/linux/sunrpc/gss_api.h b/include/linux/sunrpc/gss_api.h
index 96b02a2..459c5fc 100644
--- a/include/linux/sunrpc/gss_api.h
+++ b/include/linux/sunrpc/gss_api.h
@@ -8,7 +8,7 @@
* Bruce Fields <bfields at umich.edu>
* Copyright (c) 2000 The Regents of the University of Michigan
*
- * $Id: gss_api.h,v 1.1.1.2 2006/12/13 16:12:15 andros Exp $
+ * $Id$
*/
#ifndef _LINUX_SUNRPC_GSS_API_H
diff --git a/include/linux/sunrpc/svcauth_gss.h b/include/linux/sunrpc/svcauth_gss.h
index d2fb1ae..417a1de 100644
--- a/include/linux/sunrpc/svcauth_gss.h
+++ b/include/linux/sunrpc/svcauth_gss.h
@@ -4,7 +4,7 @@
* Bruce Fields <bfields at umich.edu>
* Copyright (c) 2002 The Regents of the Unviersity of Michigan
*
- * $Id: svcauth_gss.h,v 1.1.1.1 2006/01/19 14:36:46 andros Exp $
+ * $Id$
*
*/
diff --git a/include/linux/sunrpc/svcsock.h b/include/linux/sunrpc/svcsock.h
index 36e300b..abb1185 100644
diff --git a/include/linux/sunrpc/xprt.h b/include/linux/sunrpc/xprt.h
index edee718..b64d8df 100644
diff --git a/net/sunrpc/auth_gss/auth_gss.c b/net/sunrpc/auth_gss/auth_gss.c
index d736fcc..a6e57d1 100644
--- a/net/sunrpc/auth_gss/auth_gss.c
+++ b/net/sunrpc/auth_gss/auth_gss.c
@@ -34,7 +34,7 @@
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
- * $Id: auth_gss.c,v 1.1.1.4 2006/12/13 16:12:22 andros Exp $
+ * $Id$
*/
cvs trash in master
client side fixes
-----------------
diff --git a/include/linux/nfs4_session.h b/include/linux/nfs4_session.h
index d16920d..6faef0e 100644
--- a/include/linux/nfs4_session.h
+++ b/include/linux/nfs4_session.h
@@ -45,9 +45,6 @@ struct nfs4_channel {
/*
* Session related parameters
*/
-
-struct nfs_server;
-
struct nfs4_session {
nfs41_sessionid sess_id;
u32 flags;
@@ -63,7 +60,6 @@ struct nfs4_session {
spinlock_t session_lock;
atomic_t ref_count;
struct rpc_wait_queue recovery_waitq;
- struct nfs_server * server;
struct rpc_clnt * clnt;
};
delete unused member
diff --git a/fs/nfs/nfs4filelayout.c b/fs/nfs/nfs4filelayout.c
index 69f839d..c9c8f35 100644
--- a/fs/nfs/nfs4filelayout.c
+++ b/fs/nfs/nfs4filelayout.c
@@ -176,7 +175,7 @@ extern struct rpc_call_ops nfs_read_partial_ops;
loff_t
filelayout_get_dserver_offset(loff_t offset, struct nfs4_filelayout * layout)
{
- if (layout == NULL);
+ if (layout == NULL)
return offset;
switch (layout->stripe_type) {
bug in master
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index 184706e..4512049 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -310,8 +310,11 @@ static int nfs4_sequence_done(struct nfs_server *server,
server->session,
res, status);
break;
- default:
+ case 0:
ret = 0;
+ break;
+ default:
+ BUG();
}
return ret;
@@ -403,14 +406,17 @@ static int nfs4_setup_sequence(struct nfs_client *clp,
switch (clp->cl_minorversion) {
case 1:
- if ((ret = nfs41_recover_expired_session(task,
-clp, session)))
+ ret = nfs41_recover_expired_session(task, clp, session);
+ if (ret)
break;
ret = nfs41_setup_sequence(session, args,
res, cache_reply, task);
break;
- default:
+ case 0:
ret = 0;
+ break;
+ default:
+ BUG();
}
return ret;
@@ -507,8 +515,11 @@ int nfs4_call_sync(struct nfs_server *server,
}
break;
}
- default:
+ case 0:
ret = rpc_call_sync(clnt, msg, 0);
+ break;
+ default:
+ BUG();
}
return ret;
@@ -1711,15 +1724,17 @@ int nfs4_do_close(struct path *path, struct nfs4_state *state, int wait)
if (calldata->arg.seqid == NULL)
goto out_free_calldata;
switch (server->nfs_client->cl_minorversion) {
- case 0:
- calldata->arg.stateid = &state->open_stateid;
- break;
#ifdef CONFIG_NFS_V4_1
case 1:
calldata->arg.stateid = &state->stateid;
memset(&calldata->arg.stateid->data, 0, 4);
break;
-#endif
+#endif /* CONFIG_NFS_V4_1 */
+ case 0:
+ calldata->arg.stateid = &state->open_stateid;
+ break;
+ default:
+ BUG();
}
calldata->arg.bitmask = server->attr_bitmask;
calldata->res.fattr = &calldata->fattr;
added BUG() for minorversion non-01 case (several sites)
@@ -2922,7 +2938,7 @@ static int nfs4_read_done(struct rpc_task *task, struct nfs_read_data *data)
}
nfs_invalidate_atime(data->inode);
- if (status > 0)
+ if (task->tk_status > 0)
renew_lease(server, data->timestamp);
dprintk("<-- %s status= 0\n", __FUNCTION__);
return 0;
bug in master, status can't be >0 at this point in the code.
@@ -3576,12 +3599,14 @@ static int nfs4_handle_exception(const struct nfs_server *server, int errorcode,
case -NFS4ERR_EXPIRED:
nfs4_schedule_state_recovery(clp);
ret = nfs4_wait_clnt_recover(server->client, clp);
- if ((ret == 0) &&
- !server->nfs_client->cl_minorversion) {
+ if (ret == 0)
exception->retry = 1;
+#if !defined(CONFIG_NFS_V4_1)
break;
- }
-#if defined (CONFIG_NFS_V4_1)
+#else /* !defined(CONFIG_NFS_V4_1) */
+ if (!server->nfs_client->cl_minorversion)
+ break;
+ /* FALLTHROUGH */
case -NFS4ERR_BADSESSION:
case -NFS4ERR_BADSLOT:
case -NFS4ERR_CONN_NOT_BOUND_TO_SESSION:
master implementation needelssly changes behavior for minorversion 0
diff --git a/fs/nfs/nfs4xdr.c b/fs/nfs/nfs4xdr.c
index 74963db..1b008cb 100644
--- a/fs/nfs/nfs4xdr.c
+++ b/fs/nfs/nfs4xdr.c
@@ -61,10 +61,9 @@
@@ -349,7 +348,6 @@ static int nr_sequence_quads = 0;
#define NFS40_enc_open_downgrade_sz \
(compound_encode_hdr_maxsz + \
encode_putfh_maxsz + \
- encode_putfh_maxsz + \
encode_open_downgrade_maxsz + \
encode_getattr_maxsz)
#define NFS40_dec_open_downgrade_sz \
master has extra encode_putfh_maxsz due to bad merge/apply
@@ -3419,9 +3454,9 @@ static int nfs41_xdr_enc_pnfs_layoutget(struct rpc_rqst *req, uint32_t *p, struc
#define READ_BUF(nbytes) do { \
p = xdr_inline_decode(xdr, nbytes); \
if (unlikely(!p)) { \
- printk(KERN_INFO "%s: prematurely hit end of receive" \
+ dprintk("nfs: %s: prematurely hit end of receive" \
" buffer\n", __FUNCTION__); \
- printk(KERN_INFO "%s: xdr->p=%p, bytes=%u, xdr->end=%p\n", \
+ dprintk("nfs: %s: xdr->p=%p, bytes=%u, xdr->end=%p\n", \
__FUNCTION__, xdr->p, nbytes, xdr->end); \
return -EIO; \
} \
this and many friends, change missing from master, not sure why...
diff --git a/fs/nfs/pnfs.c b/fs/nfs/pnfs.c
index d411c45..15ad65a 100644
--- a/fs/nfs/pnfs.c
+++ b/fs/nfs/pnfs.c
@@ -71,7 +71,7 @@ extern void nfs_commit_rpcsetup(struct nfs_write_data *data, int sync);
* pnfs_spinlock:
* protects pnfs_modules_tbl.
*/
-static spinlock_t pnfs_spinlock = SPIN_LOCK_UNLOCKED;
+static spinlock_t pnfs_spinlock = __SPIN_LOCK_UNLOCKED(pnfs_spinlock);
/*
* pnfs_modules_tbl holds all pnfs modules
SPIN_LOCK_UNLOCKED was deprecated
server side fixes
-----------------
diff --git a/fs/nfsd/nfs4callback.c b/fs/nfsd/nfs4callback.c
index 0520636..679b64b 100644
--- a/fs/nfsd/nfs4callback.c
+++ b/fs/nfsd/nfs4callback.c
@@ -795,10 +801,12 @@ nfs4_cb_null(struct rpc_task *task, void *dummy)
if (task->tk_status < 0) {
dprintk("NFSD: callback establishment to client %.*s failed\n",
(int)clp->cl_name.len, clp->cl_name.data);
- return;
+ goto out;
}
atomic_set(&cb->cb_set, 1);
dprintk("NFSD: callback set to client %u.%u.%u.%u\n", NIPQUAD(addr));
+out:
+ put_nfs4_client(clp);
}
static const struct rpc_call_ops nfs4_cb_null_ops = {
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
index 68eaac6..041d4d4 100644
--- a/fs/nfsd/nfs4state.c
+++ b/fs/nfsd/nfs4state.c
@@ -1944,6 +1941,7 @@ void nfsd_break_deleg_cb(struct file_lock *fl)
printk(KERN_INFO "NFSD: Callback thread failed for "
"for client (clientid %08x/%08x)\n",
clp->cl_clientid.cl_boot, clp->cl_clientid.cl_id);
+ put_nfs4_client(dp->dl_client);
rpc_release_client(clnt);
nfs4_lock_state();
nfs4_put_delegation(dp);
these were dropped during Merge with Bruce's commits
2b47eece1fa519a81c8b802af77a8b8aa44baa10 and
cfdcad4da1903720b9b8c1f176e46a0ebf546be3
diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c
index 4018837..d4f0fa2 100644
--- a/fs/nfsd/nfs4xdr.c
+++ b/fs/nfsd/nfs4xdr.c
@@ -1606,7 +1604,14 @@ nfsd4_decode_compound(struct nfsd4_compoundargs *argp)
case OP_DESTROY_SESSION:
op->status = nfsd4_decode_destroy_session(argp, &op->u.destroy_session);
break;
-#endif
+#else /* CONFIG_NFSD_V4_1 */
+ case OP_EXCHANGE_ID:
+ case OP_CREATE_SESSION:
+ case OP_SEQUENCE:
+ case OP_DESTROY_SESSION:
+ op->status = nfserr_notsupp;
+ break;
+#endif /* CONFIG_NFSD_V4_1 */
default:
op->opnum = OP_ILLEGAL;
op->status = nfserr_op_illegal;
added error status for the !defined(CONFIG_NFSD_V4_1) case
same as we do for !defined(CONFIG_PNFS)
rpc fixes
---------
diff --git a/net/sunrpc/xprtsock.c b/net/sunrpc/xprtsock.c
index 585507e..7166ba4 100644
--- a/net/sunrpc/xprtsock.c
+++ b/net/sunrpc/xprtsock.c
@@ -2134,8 +2140,10 @@ static struct rpc_xprt *xs_setup_tcp(struct xprt_create *args)
xprt->max_payload = RPC_MAX_FRAGMENT_SIZE;
#if defined (CONFIG_NFSD_V4_1)
- if (args->svsk) { /* backchannel */
- INIT_DELAYED_WORK(&transport->connect_worker, bc_connect_worker);
+ if (args->svsk) {
+ /* backchannel */
+ INIT_DELAYED_WORK(&transport->connect_worker,
+ bc_connect_worker);
xprt->bind_timeout = 0;
xprt->connect_timeout = 0;
xprt->reestablish_timeout = 0;
@@ -2154,8 +2162,22 @@ static struct rpc_xprt *xs_setup_tcp(struct xprt_create *args)
goto next;
}
-#endif
+#endif /* CONFIG_NFSD_V4_1 */
+
+ switch (addr->sa_family) {
+ case AF_INET:
+ if (((struct sockaddr_in *)addr)->sin_port != htons(0))
+ xprt_set_bound(xprt);
+
+ INIT_DELAYED_WORK(&transport->connect_worker, xs_tcp_connect_worker4);
+ break;
+ case AF_INET6:
+ if (((struct sockaddr_in6 *)addr)->sin6_port != htons(0))
+ xprt_set_bound(xprt);
+ INIT_DELAYED_WORK(&transport->connect_worker, xs_tcp_connect_worker6);
+ break;
+ }
xprt->bind_timeout = XS_BIND_TO;
xprt->connect_timeout = XS_TCP_CONN_TO;
xprt->reestablish_timeout = XS_TCP_INIT_REEST_TO;
@@ -2171,17 +2193,9 @@ next:
switch (addr->sa_family) {
case AF_INET:
- if (((struct sockaddr_in *)addr)->sin_port != htons(0))
- xprt_set_bound(xprt);
-
- INIT_DELAYED_WORK(&transport->connect_worker, xs_tcp_connect_worker4);
xs_format_ipv4_peer_addresses(xprt);
break;
case AF_INET6:
- if (((struct sockaddr_in6 *)addr)->sin6_port != htons(0))
- xprt_set_bound(xprt);
-
- INIT_DELAYED_WORK(&transport->connect_worker, xs_tcp_connect_worker6);
xs_format_ipv6_peer_addresses(xprt);
break;
default:
re-merged with Chuck Lever's changes for ipv[46] initialization
xprt_set_bound() and INIT_DELAYED_WORK(*xs_tcp_connect_worker[46]) called
only for non-callback path while xs_format_ipv[46]_peer_addresses
called for both forward and backchannel paths.
More information about the pNFS
mailing list