Commit f6de7a39 authored by Trond Myklebust's avatar Trond Myklebust

NFSv4: Document the recover_lost_locks kernel parameter

Rename the new 'recover_locks' kernel parameter to 'recover_lost_locks'
and change the default to 'false'. Document why in
Documentation/kernel-parameters.txt

Move the 'recover_lost_locks' kernel parameter to fs/nfs/super.c to
make it easy to backport to kernels prior to 3.6.x, which don't have
a separate NFSv4 module.
Signed-off-by: default avatarTrond Myklebust <Trond.Myklebust@netapp.com>
parent ef1820f9
...@@ -1848,6 +1848,18 @@ bytes respectively. Such letter suffixes can also be entirely omitted. ...@@ -1848,6 +1848,18 @@ bytes respectively. Such letter suffixes can also be entirely omitted.
The default is to send the implementation identification The default is to send the implementation identification
information. information.
nfs.recover_lost_locks =
[NFSv4] Attempt to recover locks that were lost due
to a lease timeout on the server. Please note that
doing this risks data corruption, since there are
no guarantees that the file will remain unchanged
after the locks are lost.
If you want to enable the kernel legacy behaviour of
attempting to recover these locks, then set this
parameter to '1'.
The default parameter value of '0' causes the kernel
not to attempt recovery of lost locks.
nfsd.nfs4_disable_idmapping= nfsd.nfs4_disable_idmapping=
[NFSv4] When set to the default of '1', the NFSv4 [NFSv4] When set to the default of '1', the NFSv4
server will return only numeric uids and gids to server will return only numeric uids and gids to
......
...@@ -372,6 +372,7 @@ struct dentry *nfs4_try_mount(int, const char *, struct nfs_mount_info *, struct ...@@ -372,6 +372,7 @@ struct dentry *nfs4_try_mount(int, const char *, struct nfs_mount_info *, struct
extern bool nfs4_disable_idmapping; extern bool nfs4_disable_idmapping;
extern unsigned short max_session_slots; extern unsigned short max_session_slots;
extern unsigned short send_implementation_id; extern unsigned short send_implementation_id;
extern bool recover_lost_locks;
#define NFS4_CLIENT_ID_UNIQ_LEN (64) #define NFS4_CLIENT_ID_UNIQ_LEN (64)
extern char nfs4_client_id_uniquifier[NFS4_CLIENT_ID_UNIQ_LEN]; extern char nfs4_client_id_uniquifier[NFS4_CLIENT_ID_UNIQ_LEN];
......
...@@ -5523,12 +5523,6 @@ static int nfs4_lock_reclaim(struct nfs4_state *state, struct file_lock *request ...@@ -5523,12 +5523,6 @@ static int nfs4_lock_reclaim(struct nfs4_state *state, struct file_lock *request
return err; return err;
} }
bool recover_locks = true;
module_param(recover_locks, bool, 0644);
MODULE_PARM_DESC(recover_locks,
"If the server reports that a lock might be lost, "
"try to recovery it risking corruption.");
static int nfs4_lock_expired(struct nfs4_state *state, struct file_lock *request) static int nfs4_lock_expired(struct nfs4_state *state, struct file_lock *request)
{ {
struct nfs_server *server = NFS_SERVER(state->inode); struct nfs_server *server = NFS_SERVER(state->inode);
...@@ -5540,7 +5534,7 @@ static int nfs4_lock_expired(struct nfs4_state *state, struct file_lock *request ...@@ -5540,7 +5534,7 @@ static int nfs4_lock_expired(struct nfs4_state *state, struct file_lock *request
err = nfs4_set_lock_state(state, request); err = nfs4_set_lock_state(state, request);
if (err != 0) if (err != 0)
return err; return err;
if (!recover_locks) { if (!recover_lost_locks) {
set_bit(NFS_LOCK_LOST, &request->fl_u.nfs4_fl.owner->ls_flags); set_bit(NFS_LOCK_LOST, &request->fl_u.nfs4_fl.owner->ls_flags);
return 0; return 0;
} }
......
...@@ -2758,6 +2758,7 @@ bool nfs4_disable_idmapping = true; ...@@ -2758,6 +2758,7 @@ bool nfs4_disable_idmapping = true;
unsigned short max_session_slots = NFS4_DEF_SLOT_TABLE_SIZE; unsigned short max_session_slots = NFS4_DEF_SLOT_TABLE_SIZE;
unsigned short send_implementation_id = 1; unsigned short send_implementation_id = 1;
char nfs4_client_id_uniquifier[NFS4_CLIENT_ID_UNIQ_LEN] = ""; char nfs4_client_id_uniquifier[NFS4_CLIENT_ID_UNIQ_LEN] = "";
bool recover_lost_locks = false;
EXPORT_SYMBOL_GPL(nfs_callback_set_tcpport); EXPORT_SYMBOL_GPL(nfs_callback_set_tcpport);
EXPORT_SYMBOL_GPL(nfs_callback_tcpport); EXPORT_SYMBOL_GPL(nfs_callback_tcpport);
...@@ -2766,6 +2767,7 @@ EXPORT_SYMBOL_GPL(nfs4_disable_idmapping); ...@@ -2766,6 +2767,7 @@ EXPORT_SYMBOL_GPL(nfs4_disable_idmapping);
EXPORT_SYMBOL_GPL(max_session_slots); EXPORT_SYMBOL_GPL(max_session_slots);
EXPORT_SYMBOL_GPL(send_implementation_id); EXPORT_SYMBOL_GPL(send_implementation_id);
EXPORT_SYMBOL_GPL(nfs4_client_id_uniquifier); EXPORT_SYMBOL_GPL(nfs4_client_id_uniquifier);
EXPORT_SYMBOL_GPL(recover_lost_locks);
#define NFS_CALLBACK_MAXPORTNR (65535U) #define NFS_CALLBACK_MAXPORTNR (65535U)
...@@ -2803,4 +2805,10 @@ MODULE_PARM_DESC(send_implementation_id, ...@@ -2803,4 +2805,10 @@ MODULE_PARM_DESC(send_implementation_id,
"Send implementation ID with NFSv4.1 exchange_id"); "Send implementation ID with NFSv4.1 exchange_id");
MODULE_PARM_DESC(nfs4_unique_id, "nfs_client_id4 uniquifier string"); MODULE_PARM_DESC(nfs4_unique_id, "nfs_client_id4 uniquifier string");
module_param(recover_lost_locks, bool, 0644);
MODULE_PARM_DESC(recover_lost_locks,
"If the server reports that a lock might be lost, "
"try to recover it risking data corruption.");
#endif /* CONFIG_NFS_V4 */ #endif /* CONFIG_NFS_V4 */
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