linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Oleg Drokin <green@linuxhacker.ru>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	linux-kernel@vger.kernel.org, devel@driverdev.osuosl.org
Cc: wang di <di.wang@intel.com>, Oleg Drokin <oleg.drokin@intel.com>
Subject: [PATCH 04/17] lustre/mdc: comments on LOOKUP and PERM lock
Date: Fri, 28 Feb 2014 21:16:33 -0500	[thread overview]
Message-ID: <1393640206-20286-5-git-send-email-green@linuxhacker.ru> (raw)
In-Reply-To: <1393640206-20286-1-git-send-email-green@linuxhacker.ru>

From: wang di <di.wang@intel.com>

Add more comments for MDS_INODELOCK_PERM and
MDS_INODELOCK_LOOKUP

Signed-off-by: wang di <di.wang@intel.com>
Reviewed-on: http://review.whamcloud.com/7937
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3240
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: Oleg Drokin <oleg.drokin@intel.com>
---
 .../lustre/lustre/include/lustre/lustre_idl.h      | 24 ++++++++++++++++------
 drivers/staging/lustre/lustre/mdc/mdc_locks.c      |  3 +++
 2 files changed, 21 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/lustre/lustre/include/lustre/lustre_idl.h b/drivers/staging/lustre/lustre/include/lustre/lustre_idl.h
index 4183a35..4c70c06 100644
--- a/drivers/staging/lustre/lustre/include/lustre/lustre_idl.h
+++ b/drivers/staging/lustre/lustre/include/lustre/lustre_idl.h
@@ -2116,12 +2116,24 @@ extern void lustre_swab_generic_32s (__u32 *val);
 #define DISP_OPEN_LEASE      0x04000000
 
 /* INODE LOCK PARTS */
-#define MDS_INODELOCK_LOOKUP 0x000001       /* dentry, mode, owner, group */
-#define MDS_INODELOCK_UPDATE 0x000002       /* size, links, timestamps */
-#define MDS_INODELOCK_OPEN   0x000004       /* For opened files */
-#define MDS_INODELOCK_LAYOUT 0x000008       /* for layout */
-#define MDS_INODELOCK_PERM   0x000010       /* for permission */
-#define MDS_INODELOCK_XATTR  0x000020       /* extended attributes */
+#define MDS_INODELOCK_LOOKUP 0x000001	/* For namespace, dentry etc, and also
+					 * was used to protect permission (mode,
+					 * owner, group etc) before 2.4. */
+#define MDS_INODELOCK_UPDATE 0x000002	/* size, links, timestamps */
+#define MDS_INODELOCK_OPEN   0x000004	/* For opened files */
+#define MDS_INODELOCK_LAYOUT 0x000008	/* for layout */
+
+/* The PERM bit is added int 2.4, and it is used to protect permission(mode,
+ * owner, group, acl etc), so to separate the permission from LOOKUP lock.
+ * Because for remote directories(in DNE), these locks will be granted by
+ * different MDTs(different ldlm namespace).
+ *
+ * For local directory, MDT will always grant UPDATE_LOCK|PERM_LOCK together.
+ * For Remote directory, the master MDT, where the remote directory is, will
+ * grant UPDATE_LOCK|PERM_LOCK, and the remote MDT, where the name entry is,
+ * will grant LOOKUP_LOCK. */
+#define MDS_INODELOCK_PERM   0x000010
+#define MDS_INODELOCK_XATTR  0x000020	/* extended attributes */
 
 #define MDS_INODELOCK_MAXSHIFT 5
 /* This FULL lock is useful to take on unlink sort of operations */
diff --git a/drivers/staging/lustre/lustre/mdc/mdc_locks.c b/drivers/staging/lustre/lustre/mdc/mdc_locks.c
index 1336d47..d9017a5 100644
--- a/drivers/staging/lustre/lustre/mdc/mdc_locks.c
+++ b/drivers/staging/lustre/lustre/mdc/mdc_locks.c
@@ -1072,6 +1072,9 @@ int mdc_revalidate_lock(struct obd_export *exp, struct lookup_intent *it,
 			 * locks, there's no easy way to match all of them here,
 			 * so an extra RPC would be performed to fetch all
 			 * of those bits at once for now. */
+			/* For new MDTs(> 2.4), UPDATE|PERM should be enough,
+			 * but for old MDTs (< 2.4), permission is covered
+			 * by LOOKUP lock, so it needs to match all bits here.*/
 			policy.l_inodebits.bits = MDS_INODELOCK_UPDATE |
 						  MDS_INODELOCK_LOOKUP |
 						  MDS_INODELOCK_PERM;
-- 
1.8.5.3


  parent reply	other threads:[~2014-03-01  2:17 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-01  2:16 [PATCH 00/17] Lustre stability patches Oleg Drokin
2014-03-01  2:16 ` [PATCH 01/17] staging/lustre/llite: fix open lock matching in ll_md_blocking_ast() Oleg Drokin
2014-03-03 10:01   ` Dan Carpenter
2014-03-01  2:16 ` [PATCH 02/17] lustre/mdc: Check for all attributes validity in revalidate Oleg Drokin
2014-03-01  2:16 ` [PATCH 03/17] lustre/llite: Do not send parent dir fid in getattr by fid Oleg Drokin
2014-03-01  2:16 ` Oleg Drokin [this message]
2014-03-01  2:16 ` [PATCH 05/17] lustre/mdc: use ibits_known mask for lock match Oleg Drokin
2014-03-01  2:16 ` [PATCH 06/17] lustre/clio: honor O_NOATIME Oleg Drokin
2014-03-01  2:16 ` [PATCH 07/17] lustre/mdc: fix bad ERR_PTR usage in mdc_locks.c Oleg Drokin
2014-03-01  2:16 ` [PATCH 08/17] lustre/recovery: free open/close request promptly Oleg Drokin
2014-03-01  2:16 ` [PATCH 09/17] lustre/llite: simplify dentry revalidate Oleg Drokin
2014-03-01  2:16 ` [PATCH 10/17] lustre/ldlm: set l_lvb_type coherent when layout is returned Oleg Drokin
2014-03-01  2:16 ` [PATCH 11/17] lustre/ptlrpc: rq_commit_cb is called for twice Oleg Drokin
2014-03-01  2:16 ` [PATCH 12/17] lustre/ptlrpc: skip rpcs that fail ptl_send_rpc Oleg Drokin
2014-03-01  2:16 ` [PATCH 13/17] lustre/ptlrpc: fix 'data race condition' issues Oleg Drokin
2014-03-01  2:16 ` [PATCH 14/17] lustre/ptlrpc: re-enqueue ptlrpcd worker Oleg Drokin
2014-03-01  2:16 ` [PATCH 15/17] lustre/osc: Don't flush active extents Oleg Drokin
2014-03-01  2:16 ` [PATCH 16/17] lustre/quota: improper assert in osc_quota_chkdq() Oleg Drokin
2014-03-01  2:16 ` [PATCH 17/17] lustre/libcfs: warn if all HTs in a core are gone Oleg Drokin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1393640206-20286-5-git-send-email-green@linuxhacker.ru \
    --to=green@linuxhacker.ru \
    --cc=devel@driverdev.osuosl.org \
    --cc=di.wang@intel.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=oleg.drokin@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).