Commit f6de7a39c181dfb8a2c534661a53c73afb3081cd

Authored by Trond Myklebust
1 parent ef1820f9be

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: Trond Myklebust <Trond.Myklebust@netapp.com>

Showing 4 changed files with 22 additions and 7 deletions Side-by-side Diff

Documentation/kernel-parameters.txt
... ... @@ -1847,6 +1847,18 @@
1847 1847 will be sent.
1848 1848 The default is to send the implementation identification
1849 1849 information.
  1850 +
  1851 + nfs.recover_lost_locks =
  1852 + [NFSv4] Attempt to recover locks that were lost due
  1853 + to a lease timeout on the server. Please note that
  1854 + doing this risks data corruption, since there are
  1855 + no guarantees that the file will remain unchanged
  1856 + after the locks are lost.
  1857 + If you want to enable the kernel legacy behaviour of
  1858 + attempting to recover these locks, then set this
  1859 + parameter to '1'.
  1860 + The default parameter value of '0' causes the kernel
  1861 + not to attempt recovery of lost locks.
1850 1862  
1851 1863 nfsd.nfs4_disable_idmapping=
1852 1864 [NFSv4] When set to the default of '1', the NFSv4
... ... @@ -372,6 +372,7 @@
372 372 extern bool nfs4_disable_idmapping;
373 373 extern unsigned short max_session_slots;
374 374 extern unsigned short send_implementation_id;
  375 +extern bool recover_lost_locks;
375 376  
376 377 #define NFS4_CLIENT_ID_UNIQ_LEN (64)
377 378 extern char nfs4_client_id_uniquifier[NFS4_CLIENT_ID_UNIQ_LEN];
... ... @@ -5523,12 +5523,6 @@
5523 5523 return err;
5524 5524 }
5525 5525  
5526   -bool recover_locks = true;
5527   -module_param(recover_locks, bool, 0644);
5528   -MODULE_PARM_DESC(recover_locks,
5529   - "If the server reports that a lock might be lost, "
5530   - "try to recovery it risking corruption.");
5531   -
5532 5526 static int nfs4_lock_expired(struct nfs4_state *state, struct file_lock *request)
5533 5527 {
5534 5528 struct nfs_server *server = NFS_SERVER(state->inode);
... ... @@ -5540,7 +5534,7 @@
5540 5534 err = nfs4_set_lock_state(state, request);
5541 5535 if (err != 0)
5542 5536 return err;
5543   - if (!recover_locks) {
  5537 + if (!recover_lost_locks) {
5544 5538 set_bit(NFS_LOCK_LOST, &request->fl_u.nfs4_fl.owner->ls_flags);
5545 5539 return 0;
5546 5540 }
... ... @@ -2758,6 +2758,7 @@
2758 2758 unsigned short max_session_slots = NFS4_DEF_SLOT_TABLE_SIZE;
2759 2759 unsigned short send_implementation_id = 1;
2760 2760 char nfs4_client_id_uniquifier[NFS4_CLIENT_ID_UNIQ_LEN] = "";
  2761 +bool recover_lost_locks = false;
2761 2762  
2762 2763 EXPORT_SYMBOL_GPL(nfs_callback_set_tcpport);
2763 2764 EXPORT_SYMBOL_GPL(nfs_callback_tcpport);
... ... @@ -2766,6 +2767,7 @@
2766 2767 EXPORT_SYMBOL_GPL(max_session_slots);
2767 2768 EXPORT_SYMBOL_GPL(send_implementation_id);
2768 2769 EXPORT_SYMBOL_GPL(nfs4_client_id_uniquifier);
  2770 +EXPORT_SYMBOL_GPL(recover_lost_locks);
2769 2771  
2770 2772 #define NFS_CALLBACK_MAXPORTNR (65535U)
2771 2773  
... ... @@ -2802,6 +2804,12 @@
2802 2804 MODULE_PARM_DESC(send_implementation_id,
2803 2805 "Send implementation ID with NFSv4.1 exchange_id");
2804 2806 MODULE_PARM_DESC(nfs4_unique_id, "nfs_client_id4 uniquifier string");
  2807 +
  2808 +module_param(recover_lost_locks, bool, 0644);
  2809 +MODULE_PARM_DESC(recover_lost_locks,
  2810 + "If the server reports that a lock might be lost, "
  2811 + "try to recover it risking data corruption.");
  2812 +
2805 2813  
2806 2814 #endif /* CONFIG_NFS_V4 */