Commit 29be6345 authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'nfs-for-3.13-3' of git://git.linux-nfs.org/projects/trondmy/linux-nfs

Pull NFS client bugfixes from Trond Myklebust:
 - Stable fix for a NFSv4.1 delegation and state recovery deadlock
 - Stable fix for a loop on irrecoverable errors when returning
   delegations
 - Fix a 3-way deadlock between layoutreturn, open, and state recovery
 - Update the MAINTAINERS file with contact information for Trond
   Myklebust
 - Close needs to handle NFS4ERR_ADMIN_REVOKED
 - Enabling v4.2 should not recompile nfsd and lockd
 - Fix a couple of compile warnings

* tag 'nfs-for-3.13-3' of git://git.linux-nfs.org/projects/trondmy/linux-nfs:
  nfs: fix do_div() warning by instead using sector_div()
  MAINTAINERS: Update contact information for Trond Myklebust
  NFSv4.1: Prevent a 3-way deadlock between layoutreturn, open and state recovery
  SUNRPC: do not fail gss proc NULL calls with EACCES
  NFSv4: close needs to handle NFS4ERR_ADMIN_REVOKED
  NFSv4: Update list of irrecoverable errors on DELEGRETURN
  NFSv4 wait on recovery for async session errors
  NFS: Fix a warning in nfs_setsecurity
  NFS: Enabling v4.2 should not recompile nfsd and lockd
parents ef1e4e32 3873d064
...@@ -5980,10 +5980,10 @@ F: drivers/nfc/ ...@@ -5980,10 +5980,10 @@ F: drivers/nfc/
F: include/linux/platform_data/pn544.h F: include/linux/platform_data/pn544.h
NFS, SUNRPC, AND LOCKD CLIENTS NFS, SUNRPC, AND LOCKD CLIENTS
M: Trond Myklebust <Trond.Myklebust@netapp.com> M: Trond Myklebust <trond.myklebust@primarydata.com>
L: linux-nfs@vger.kernel.org L: linux-nfs@vger.kernel.org
W: http://client.linux-nfs.org W: http://client.linux-nfs.org
T: git git://git.linux-nfs.org/pub/linux/nfs-2.6.git T: git git://git.linux-nfs.org/projects/trondmy/linux-nfs.git
S: Maintained S: Maintained
F: fs/lockd/ F: fs/lockd/
F: fs/nfs/ F: fs/nfs/
......
...@@ -36,6 +36,7 @@ ...@@ -36,6 +36,7 @@
#include <linux/nfs_fs.h> #include <linux/nfs_fs.h>
#include <linux/sunrpc/rpc_pipe_fs.h> #include <linux/sunrpc/rpc_pipe_fs.h>
#include "../nfs4_fs.h"
#include "../pnfs.h" #include "../pnfs.h"
#include "../netns.h" #include "../netns.h"
......
...@@ -44,7 +44,7 @@ ...@@ -44,7 +44,7 @@
static inline sector_t normalize(sector_t s, int base) static inline sector_t normalize(sector_t s, int base)
{ {
sector_t tmp = s; /* Since do_div modifies its argument */ sector_t tmp = s; /* Since do_div modifies its argument */
return s - do_div(tmp, base); return s - sector_div(tmp, base);
} }
static inline sector_t normalize_up(sector_t s, int base) static inline sector_t normalize_up(sector_t s, int base)
......
...@@ -46,7 +46,9 @@ ssize_t nfs_dns_resolve_name(struct net *net, char *name, size_t namelen, ...@@ -46,7 +46,9 @@ ssize_t nfs_dns_resolve_name(struct net *net, char *name, size_t namelen,
#include <linux/sunrpc/cache.h> #include <linux/sunrpc/cache.h>
#include <linux/sunrpc/svcauth.h> #include <linux/sunrpc/svcauth.h>
#include <linux/sunrpc/rpc_pipe_fs.h> #include <linux/sunrpc/rpc_pipe_fs.h>
#include <linux/nfs_fs.h>
#include "nfs4_fs.h"
#include "dns_resolve.h" #include "dns_resolve.h"
#include "cache_lib.h" #include "cache_lib.h"
#include "netns.h" #include "netns.h"
......
...@@ -312,7 +312,7 @@ struct nfs4_label *nfs4_label_alloc(struct nfs_server *server, gfp_t flags) ...@@ -312,7 +312,7 @@ struct nfs4_label *nfs4_label_alloc(struct nfs_server *server, gfp_t flags)
} }
EXPORT_SYMBOL_GPL(nfs4_label_alloc); EXPORT_SYMBOL_GPL(nfs4_label_alloc);
#else #else
void inline nfs_setsecurity(struct inode *inode, struct nfs_fattr *fattr, void nfs_setsecurity(struct inode *inode, struct nfs_fattr *fattr,
struct nfs4_label *label) struct nfs4_label *label)
{ {
} }
......
...@@ -269,6 +269,21 @@ extern const u32 nfs41_maxgetdevinfo_overhead; ...@@ -269,6 +269,21 @@ extern const u32 nfs41_maxgetdevinfo_overhead;
extern struct rpc_procinfo nfs4_procedures[]; extern struct rpc_procinfo nfs4_procedures[];
#endif #endif
#ifdef CONFIG_NFS_V4_SECURITY_LABEL
extern struct nfs4_label *nfs4_label_alloc(struct nfs_server *server, gfp_t flags);
static inline void nfs4_label_free(struct nfs4_label *label)
{
if (label) {
kfree(label->label);
kfree(label);
}
return;
}
#else
static inline struct nfs4_label *nfs4_label_alloc(struct nfs_server *server, gfp_t flags) { return NULL; }
static inline void nfs4_label_free(void *label) {}
#endif /* CONFIG_NFS_V4_SECURITY_LABEL */
/* proc.c */ /* proc.c */
void nfs_close_context(struct nfs_open_context *ctx, int is_sync); void nfs_close_context(struct nfs_open_context *ctx, int is_sync);
extern struct nfs_client *nfs_init_client(struct nfs_client *clp, extern struct nfs_client *nfs_init_client(struct nfs_client *clp,
......
...@@ -9,6 +9,14 @@ ...@@ -9,6 +9,14 @@
#ifndef __LINUX_FS_NFS_NFS4_FS_H #ifndef __LINUX_FS_NFS_NFS4_FS_H
#define __LINUX_FS_NFS_NFS4_FS_H #define __LINUX_FS_NFS_NFS4_FS_H
#if defined(CONFIG_NFS_V4_2)
#define NFS4_MAX_MINOR_VERSION 2
#elif defined(CONFIG_NFS_V4_1)
#define NFS4_MAX_MINOR_VERSION 1
#else
#define NFS4_MAX_MINOR_VERSION 0
#endif
#if IS_ENABLED(CONFIG_NFS_V4) #if IS_ENABLED(CONFIG_NFS_V4)
#define NFS4_MAX_LOOP_ON_RECOVER (10) #define NFS4_MAX_LOOP_ON_RECOVER (10)
......
...@@ -2518,9 +2518,8 @@ static void nfs4_close_done(struct rpc_task *task, void *data) ...@@ -2518,9 +2518,8 @@ static void nfs4_close_done(struct rpc_task *task, void *data)
calldata->roc_barrier); calldata->roc_barrier);
nfs_set_open_stateid(state, &calldata->res.stateid, 0); nfs_set_open_stateid(state, &calldata->res.stateid, 0);
renew_lease(server, calldata->timestamp); renew_lease(server, calldata->timestamp);
nfs4_close_clear_stateid_flags(state,
calldata->arg.fmode);
break; break;
case -NFS4ERR_ADMIN_REVOKED:
case -NFS4ERR_STALE_STATEID: case -NFS4ERR_STALE_STATEID:
case -NFS4ERR_OLD_STATEID: case -NFS4ERR_OLD_STATEID:
case -NFS4ERR_BAD_STATEID: case -NFS4ERR_BAD_STATEID:
...@@ -2528,9 +2527,13 @@ static void nfs4_close_done(struct rpc_task *task, void *data) ...@@ -2528,9 +2527,13 @@ static void nfs4_close_done(struct rpc_task *task, void *data)
if (calldata->arg.fmode == 0) if (calldata->arg.fmode == 0)
break; break;
default: default:
if (nfs4_async_handle_error(task, server, state) == -EAGAIN) if (nfs4_async_handle_error(task, server, state) == -EAGAIN) {
rpc_restart_call_prepare(task); rpc_restart_call_prepare(task);
goto out_release;
}
} }
nfs4_close_clear_stateid_flags(state, calldata->arg.fmode);
out_release:
nfs_release_seqid(calldata->arg.seqid); nfs_release_seqid(calldata->arg.seqid);
nfs_refresh_inode(calldata->inode, calldata->res.fattr); nfs_refresh_inode(calldata->inode, calldata->res.fattr);
dprintk("%s: done, ret = %d!\n", __func__, task->tk_status); dprintk("%s: done, ret = %d!\n", __func__, task->tk_status);
...@@ -4802,7 +4805,7 @@ nfs4_async_handle_error(struct rpc_task *task, const struct nfs_server *server, ...@@ -4802,7 +4805,7 @@ nfs4_async_handle_error(struct rpc_task *task, const struct nfs_server *server,
dprintk("%s ERROR %d, Reset session\n", __func__, dprintk("%s ERROR %d, Reset session\n", __func__,
task->tk_status); task->tk_status);
nfs4_schedule_session_recovery(clp->cl_session, task->tk_status); nfs4_schedule_session_recovery(clp->cl_session, task->tk_status);
goto restart_call; goto wait_on_recovery;
#endif /* CONFIG_NFS_V4_1 */ #endif /* CONFIG_NFS_V4_1 */
case -NFS4ERR_DELAY: case -NFS4ERR_DELAY:
nfs_inc_server_stats(server, NFSIOS_DELAY); nfs_inc_server_stats(server, NFSIOS_DELAY);
...@@ -4987,11 +4990,17 @@ static void nfs4_delegreturn_done(struct rpc_task *task, void *calldata) ...@@ -4987,11 +4990,17 @@ static void nfs4_delegreturn_done(struct rpc_task *task, void *calldata)
trace_nfs4_delegreturn_exit(&data->args, &data->res, task->tk_status); trace_nfs4_delegreturn_exit(&data->args, &data->res, task->tk_status);
switch (task->tk_status) { switch (task->tk_status) {
case -NFS4ERR_STALE_STATEID:
case -NFS4ERR_EXPIRED:
case 0: case 0:
renew_lease(data->res.server, data->timestamp); renew_lease(data->res.server, data->timestamp);
break; break;
case -NFS4ERR_ADMIN_REVOKED:
case -NFS4ERR_DELEG_REVOKED:
case -NFS4ERR_BAD_STATEID:
case -NFS4ERR_OLD_STATEID:
case -NFS4ERR_STALE_STATEID:
case -NFS4ERR_EXPIRED:
task->tk_status = 0;
break;
default: default:
if (nfs4_async_handle_error(task, data->res.server, NULL) == if (nfs4_async_handle_error(task, data->res.server, NULL) ==
-EAGAIN) { -EAGAIN) {
...@@ -7589,7 +7598,14 @@ static void nfs4_layoutreturn_done(struct rpc_task *task, void *calldata) ...@@ -7589,7 +7598,14 @@ static void nfs4_layoutreturn_done(struct rpc_task *task, void *calldata)
return; return;
server = NFS_SERVER(lrp->args.inode); server = NFS_SERVER(lrp->args.inode);
if (nfs4_async_handle_error(task, server, NULL) == -EAGAIN) { switch (task->tk_status) {
default:
task->tk_status = 0;
case 0:
break;
case -NFS4ERR_DELAY:
if (nfs4_async_handle_error(task, server, NULL) != -EAGAIN)
break;
rpc_restart_call_prepare(task); rpc_restart_call_prepare(task);
return; return;
} }
......
...@@ -413,16 +413,6 @@ enum lock_type4 { ...@@ -413,16 +413,6 @@ enum lock_type4 {
#define NFS4_VERSION 4 #define NFS4_VERSION 4
#define NFS4_MINOR_VERSION 0 #define NFS4_MINOR_VERSION 0
#if defined(CONFIG_NFS_V4_2)
#define NFS4_MAX_MINOR_VERSION 2
#else
#if defined(CONFIG_NFS_V4_1)
#define NFS4_MAX_MINOR_VERSION 1
#else
#define NFS4_MAX_MINOR_VERSION 0
#endif /* CONFIG_NFS_V4_1 */
#endif /* CONFIG_NFS_V4_2 */
#define NFS4_DEBUG 1 #define NFS4_DEBUG 1
/* Index of predefined Linux client operations */ /* Index of predefined Linux client operations */
......
...@@ -506,24 +506,6 @@ extern const struct inode_operations nfs_referral_inode_operations; ...@@ -506,24 +506,6 @@ extern const struct inode_operations nfs_referral_inode_operations;
extern int nfs_mountpoint_expiry_timeout; extern int nfs_mountpoint_expiry_timeout;
extern void nfs_release_automount_timer(void); extern void nfs_release_automount_timer(void);
/*
* linux/fs/nfs/nfs4proc.c
*/
#ifdef CONFIG_NFS_V4_SECURITY_LABEL
extern struct nfs4_label *nfs4_label_alloc(struct nfs_server *server, gfp_t flags);
static inline void nfs4_label_free(struct nfs4_label *label)
{
if (label) {
kfree(label->label);
kfree(label);
}
return;
}
#else
static inline struct nfs4_label *nfs4_label_alloc(struct nfs_server *server, gfp_t flags) { return NULL; }
static inline void nfs4_label_free(void *label) {}
#endif
/* /*
* linux/fs/nfs/unlink.c * linux/fs/nfs/unlink.c
*/ */
......
...@@ -1517,7 +1517,7 @@ gss_refresh(struct rpc_task *task) ...@@ -1517,7 +1517,7 @@ gss_refresh(struct rpc_task *task)
static int static int
gss_refresh_null(struct rpc_task *task) gss_refresh_null(struct rpc_task *task)
{ {
return -EACCES; return 0;
} }
static __be32 * static __be32 *
......
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