diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2010-11-12 07:59:41 -0800 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-11-12 07:59:41 -0800 |
commit | 0f90933c477c061df6daf42d814ff2012aea43cc (patch) | |
tree | 10c1e1ec16a1874416f9aa18e44a31a6d3087952 /include | |
parent | e2b348354112df63a9c2ea4219a6867c6c7ea100 (diff) | |
parent | 8896b93f42459b18b145c69d399b62870df48061 (diff) | |
download | linux-0f90933c477c061df6daf42d814ff2012aea43cc.tar.bz2 |
Merge branch 'for-2.6.37' of git://linux-nfs.org/~bfields/linux
* 'for-2.6.37' of git://linux-nfs.org/~bfields/linux:
locks: remove dead lease error-handling code
locks: fix leak on merging leases
nfsd4: fix 4.1 connection registration race
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/sunrpc/svc_xprt.h | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/include/linux/sunrpc/svc_xprt.h b/include/linux/sunrpc/svc_xprt.h index bbdb680ffbe9..aea0d438e3c7 100644 --- a/include/linux/sunrpc/svc_xprt.h +++ b/include/linux/sunrpc/svc_xprt.h @@ -82,18 +82,28 @@ struct svc_xprt { struct net *xpt_net; }; -static inline void register_xpt_user(struct svc_xprt *xpt, struct svc_xpt_user *u) +static inline void unregister_xpt_user(struct svc_xprt *xpt, struct svc_xpt_user *u) { spin_lock(&xpt->xpt_lock); - list_add(&u->list, &xpt->xpt_users); + list_del_init(&u->list); spin_unlock(&xpt->xpt_lock); } -static inline void unregister_xpt_user(struct svc_xprt *xpt, struct svc_xpt_user *u) +static inline int register_xpt_user(struct svc_xprt *xpt, struct svc_xpt_user *u) { spin_lock(&xpt->xpt_lock); - list_del_init(&u->list); + if (test_bit(XPT_CLOSE, &xpt->xpt_flags)) { + /* + * The connection is about to be deleted soon (or, + * worse, may already be deleted--in which case we've + * already notified the xpt_users). + */ + spin_unlock(&xpt->xpt_lock); + return -ENOTCONN; + } + list_add(&u->list, &xpt->xpt_users); spin_unlock(&xpt->xpt_lock); + return 0; } int svc_reg_xprt_class(struct svc_xprt_class *); |