linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 00/18] fill in missing patches present in 2.4.92 version
@ 2016-04-05  1:36 James Simmons
  2016-04-05  1:36 ` [PATCH 01/18] staging: lustre: ldlm: fix 'deadcode' errors James Simmons
                   ` (17 more replies)
  0 siblings, 18 replies; 21+ messages in thread
From: James Simmons @ 2016-04-05  1:36 UTC (permalink / raw)
  To: Greg Kroah-Hartman, devel, Andreas Dilger, Oleg Drokin
  Cc: Linux Kernel Mailing List, Lustre Development List, James Simmons

After the lustre client code was merged patches continued to land but
gaps did happen were several patches were missed. This batch of patches
are bug fixes that happened after the upstream client merger and before
the creation of lustre version 2.4.92 tag.

Aurelien Degremont (1):
  staging: lustre: hsm: copy start error should set HP_FLAG_COMPLETED

Gaurav Mahajan (1):
  staging: lustre: llite: Delaying creation of client side proc entries.

JC Lafoucriere (2):
  staging: lustre: hsm: rename hai_zero() HSM function
  staging: lustre: hsm: Add CLF_RENAME_LAST flag

James Simmons (1):
  staging: lustre: osc: Lustre returns EINTR from writes when SA_RESTART is set

Jinshan Xiong (7):
  staging: lustre: libcfs: remove userland comments in libcfs_debug.h
  staging: lustre: libcfs: create array of debug names
  staging: lustre: libcfs: make D_HSM a unique value
  staging: lustre: hsm: Fix lu_ref for lease handle
  staging: lustre: llite: reset writeback index in ll_writepages
  staging: lustre: llite: cancel open lock before closing file
  staging: lustre: hsm: Add support to drop all pages for ll_data_version

Ned Bass (1):
  staging: lustre: mdc: document mdc_rpc_lock

Niu Yawei (1):
  staging: lustre: llite: use 64bits flags in ll_lov_setea()

Sebastien Buisson (3):
  staging: lustre: ldlm: fix 'deadcode' errors
  staging: lustre: fix 'NULL pointer dereference' errors
  staging: lustre: fix 'no effect' errors

Swapnil Pimpale (1):
  staging: lustre: lov: Get the correct address of lmm_objects

 .../lustre/include/linux/libcfs/libcfs_debug.h     |   18 ++-
 drivers/staging/lustre/lnet/libcfs/debug.c         |  126 ++------------------
 .../lustre/lustre/include/lustre/lustre_idl.h      |    1 +
 .../lustre/lustre/include/lustre/lustre_user.h     |   18 ++-
 drivers/staging/lustre/lustre/include/lustre_mdc.h |   18 +++
 drivers/staging/lustre/lustre/ldlm/ldlm_flock.c    |    6 -
 drivers/staging/lustre/lustre/llite/dir.c          |   18 ++-
 drivers/staging/lustre/lustre/llite/file.c         |   59 ++++++----
 .../staging/lustre/lustre/llite/llite_internal.h   |    4 +-
 drivers/staging/lustre/lustre/llite/llite_lib.c    |   16 ++-
 drivers/staging/lustre/lustre/llite/rw.c           |    5 +-
 drivers/staging/lustre/lustre/llite/xattr.c        |    9 +-
 drivers/staging/lustre/lustre/lmv/lmv_obd.c        |    2 +-
 drivers/staging/lustre/lustre/lov/lov_io.c         |    3 +-
 drivers/staging/lustre/lustre/lov/lov_merge.c      |   11 ++
 drivers/staging/lustre/lustre/lov/lov_pack.c       |    3 +-
 drivers/staging/lustre/lustre/mdc/mdc_lib.c        |    2 +-
 drivers/staging/lustre/lustre/mdc/mdc_request.c    |    2 +-
 drivers/staging/lustre/lustre/osc/osc_cache.c      |   42 +++++--
 19 files changed, 166 insertions(+), 197 deletions(-)

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [PATCH 01/18] staging: lustre: ldlm: fix 'deadcode' errors
  2016-04-05  1:36 [PATCH 00/18] fill in missing patches present in 2.4.92 version James Simmons
@ 2016-04-05  1:36 ` James Simmons
  2016-04-05  1:36 ` [PATCH 02/18] staging: lustre: llite: use 64bits flags in ll_lov_setea() James Simmons
                   ` (16 subsequent siblings)
  17 siblings, 0 replies; 21+ messages in thread
From: James Simmons @ 2016-04-05  1:36 UTC (permalink / raw)
  To: Greg Kroah-Hartman, devel, Andreas Dilger, Oleg Drokin
  Cc: Linux Kernel Mailing List, Lustre Development List,
	Sebastien Buisson, James Simmons

From: Sebastien Buisson <sbuisson@ddn.com>

Fix 'deadcode' issues found by Coverity version 6.5.1:
Logically dead code (DEADCODE)
Execution cannot reach this statement.

Signed-off-by: Sebastien Buisson <sbuisson@ddn.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3097
Reviewed-on: http://review.whamcloud.com/7167
Reviewed-by: Dmitry Eremin <dmitry.eremin@intel.com>
Reviewed-by: John L. Hammond <john.hammond@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: James Simmons <jsimmons@infradead.org>
---
 drivers/staging/lustre/lustre/ldlm/ldlm_flock.c |    6 ------
 1 files changed, 0 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_flock.c b/drivers/staging/lustre/lustre/ldlm/ldlm_flock.c
index b88b786..3f97e1c 100644
--- a/drivers/staging/lustre/lustre/ldlm/ldlm_flock.c
+++ b/drivers/staging/lustre/lustre/ldlm/ldlm_flock.c
@@ -530,12 +530,6 @@ granted:
 		return -EIO;
 	}
 
-	if (rc) {
-		LDLM_DEBUG(lock, "client-side enqueue waking up: failed (%d)",
-			   rc);
-		return rc;
-	}
-
 	LDLM_DEBUG(lock, "client-side enqueue granted");
 
 	lock_res_and_lock(lock);
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH 02/18] staging: lustre: llite: use 64bits flags in ll_lov_setea()
  2016-04-05  1:36 [PATCH 00/18] fill in missing patches present in 2.4.92 version James Simmons
  2016-04-05  1:36 ` [PATCH 01/18] staging: lustre: ldlm: fix 'deadcode' errors James Simmons
@ 2016-04-05  1:36 ` James Simmons
  2016-04-05  1:36 ` [PATCH 03/18] staging: lustre: libcfs: remove userland comments in libcfs_debug.h James Simmons
                   ` (15 subsequent siblings)
  17 siblings, 0 replies; 21+ messages in thread
From: James Simmons @ 2016-04-05  1:36 UTC (permalink / raw)
  To: Greg Kroah-Hartman, devel, Andreas Dilger, Oleg Drokin
  Cc: Linux Kernel Mailing List, Lustre Development List, Niu Yawei,
	James Simmons

From: Niu Yawei <yawei.niu@intel.com>

In ll_lov_setea(), setting MDS_OPEN_HAS_OBJS to an int flags will
result in the flags being overflowed.

Signed-off-by: Niu Yawei <yawei.niu@intel.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3744
Reviewed-on: http://review.whamcloud.com/7312
Reviewed-by: Emoly Liu <emoly.liu@intel.com>
Reviewed-by: Jian Yu <jian.yu@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: James Simmons <jsimmons@infradead.org>
---
 drivers/staging/lustre/lustre/llite/file.c         |    7 ++++---
 .../staging/lustre/lustre/llite/llite_internal.h   |    2 +-
 drivers/staging/lustre/lustre/llite/xattr.c        |    6 +++---
 3 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/drivers/staging/lustre/lustre/llite/file.c b/drivers/staging/lustre/lustre/llite/file.c
index 69b56a8..02b5783 100644
--- a/drivers/staging/lustre/lustre/llite/file.c
+++ b/drivers/staging/lustre/lustre/llite/file.c
@@ -1363,7 +1363,8 @@ static int ll_lov_recreate_fid(struct inode *inode, unsigned long arg)
 }
 
 int ll_lov_setstripe_ea_info(struct inode *inode, struct dentry *dentry,
-			     int flags, struct lov_user_md *lum, int lum_size)
+			     __u64 flags, struct lov_user_md *lum,
+			     int lum_size)
 {
 	struct lov_stripe_md *lsm = NULL;
 	struct lookup_intent oit = {.it_op = IT_OPEN, .it_flags = flags};
@@ -1487,7 +1488,7 @@ out:
 static int ll_lov_setea(struct inode *inode, struct file *file,
 			unsigned long arg)
 {
-	int			 flags = MDS_OPEN_HAS_OBJS | FMODE_WRITE;
+	__u64			 flags = MDS_OPEN_HAS_OBJS | FMODE_WRITE;
 	struct lov_user_md	*lump;
 	int			 lum_size = sizeof(struct lov_user_md) +
 					    sizeof(struct lov_user_ost_data);
@@ -1521,7 +1522,7 @@ static int ll_lov_setstripe(struct inode *inode, struct file *file,
 	struct lov_user_md_v1 __user *lumv1p = (void __user *)arg;
 	struct lov_user_md_v3 __user *lumv3p = (void __user *)arg;
 	int lum_size, rc;
-	int flags = FMODE_WRITE;
+	__u64 flags = FMODE_WRITE;
 
 	/* first try with v1 which is smaller than v3 */
 	lum_size = sizeof(struct lov_user_md_v1);
diff --git a/drivers/staging/lustre/lustre/llite/llite_internal.h b/drivers/staging/lustre/lustre/llite/llite_internal.h
index ba24f09..ccbb9be 100644
--- a/drivers/staging/lustre/lustre/llite/llite_internal.h
+++ b/drivers/staging/lustre/lustre/llite/llite_internal.h
@@ -745,7 +745,7 @@ struct posix_acl *ll_get_acl(struct inode *inode, int type);
 int ll_inode_permission(struct inode *inode, int mask);
 
 int ll_lov_setstripe_ea_info(struct inode *inode, struct dentry *dentry,
-			     int flags, struct lov_user_md *lum,
+			     __u64 flags, struct lov_user_md *lum,
 			     int lum_size);
 int ll_lov_getstripe_ea_info(struct inode *inode, const char *filename,
 			     struct lov_mds_md **lmm, int *lmm_size,
diff --git a/drivers/staging/lustre/lustre/llite/xattr.c b/drivers/staging/lustre/lustre/llite/xattr.c
index b68dcc9..6282478 100644
--- a/drivers/staging/lustre/lustre/llite/xattr.c
+++ b/drivers/staging/lustre/lustre/llite/xattr.c
@@ -243,12 +243,12 @@ int ll_setxattr(struct dentry *dentry, const char *name,
 			lump->lmm_stripe_offset = -1;
 
 		if (lump && S_ISREG(inode->i_mode)) {
-			int flags = FMODE_WRITE;
+			__u64 it_flags = FMODE_WRITE;
 			int lum_size = (lump->lmm_magic == LOV_USER_MAGIC_V1) ?
 				sizeof(*lump) : sizeof(struct lov_user_md_v3);
 
-			rc = ll_lov_setstripe_ea_info(inode, dentry, flags, lump,
-						      lum_size);
+			rc = ll_lov_setstripe_ea_info(inode, dentry, it_flags,
+						      lump, lum_size);
 			/* b10667: rc always be 0 here for now */
 			rc = 0;
 		} else if (S_ISDIR(inode->i_mode)) {
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH 03/18] staging: lustre: libcfs: remove userland comments in libcfs_debug.h
  2016-04-05  1:36 [PATCH 00/18] fill in missing patches present in 2.4.92 version James Simmons
  2016-04-05  1:36 ` [PATCH 01/18] staging: lustre: ldlm: fix 'deadcode' errors James Simmons
  2016-04-05  1:36 ` [PATCH 02/18] staging: lustre: llite: use 64bits flags in ll_lov_setea() James Simmons
@ 2016-04-05  1:36 ` James Simmons
  2016-04-05  1:36 ` [PATCH 04/18] staging: lustre: libcfs: create array of debug names James Simmons
                   ` (14 subsequent siblings)
  17 siblings, 0 replies; 21+ messages in thread
From: James Simmons @ 2016-04-05  1:36 UTC (permalink / raw)
  To: Greg Kroah-Hartman, devel, Andreas Dilger, Oleg Drokin
  Cc: Linux Kernel Mailing List, Lustre Development List,
	Jinshan Xiong, James Simmons

From: Jinshan Xiong <jinshan.xiong@intel.com>

Remove comments about userland use.

Signed-off-by: Jinshan Xiong <jinshan.xiong@intel.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3647
Reviewed-on: http://review.whamcloud.com/7243
Reviewed-by: John L. Hammond <john.hammond@intel.com>
Reviewed-by: jacques-Charles Lafoucriere <jacques-charles.lafoucriere@cea.fr>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: James Simmons <jsimmons@infradead.org>
---
 .../lustre/include/linux/libcfs/libcfs_debug.h     |    4 ----
 1 files changed, 0 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/lustre/include/linux/libcfs/libcfs_debug.h b/drivers/staging/lustre/include/linux/libcfs/libcfs_debug.h
index 98430e7..7472a31 100644
--- a/drivers/staging/lustre/include/linux/libcfs/libcfs_debug.h
+++ b/drivers/staging/lustre/include/linux/libcfs/libcfs_debug.h
@@ -85,7 +85,6 @@ struct ptldebug_header {
 #define PH_FLAG_FIRST_RECORD 1
 
 /* Debugging subsystems (32 bits, non-overlapping) */
-/* keep these in sync with lnet/utils/debug.c and lnet/libcfs/debug.c */
 #define S_UNDEFINED	0x00000001
 #define S_MDC		0x00000002
 #define S_MDS		0x00000004
@@ -118,10 +117,8 @@ struct ptldebug_header {
 #define S_MGS		0x20000000
 #define S_FID		0x40000000 /* b_new_cmd */
 #define S_FLD		0x80000000 /* b_new_cmd */
-/* keep these in sync with lnet/utils/debug.c and lnet/libcfs/debug.c */
 
 /* Debugging masks (32 bits, non-overlapping) */
-/* keep these in sync with lnet/utils/debug.c and lnet/libcfs/debug.c */
 #define D_TRACE		0x00000001 /* ENTRY/EXIT markers */
 #define D_INODE		0x00000002
 #define D_SUPER		0x00000004
@@ -151,7 +148,6 @@ struct ptldebug_header {
 #define D_QUOTA		0x04000000
 #define D_SEC		0x08000000
 #define D_LFSCK		0x10000000 /* For both OI scrub and LFSCK */
-/* keep these in sync with lnet/{utils,libcfs}/debug.c */
 
 #define D_HSM	 D_TRACE
 
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH 04/18] staging: lustre: libcfs: create array of debug names
  2016-04-05  1:36 [PATCH 00/18] fill in missing patches present in 2.4.92 version James Simmons
                   ` (2 preceding siblings ...)
  2016-04-05  1:36 ` [PATCH 03/18] staging: lustre: libcfs: remove userland comments in libcfs_debug.h James Simmons
@ 2016-04-05  1:36 ` James Simmons
  2016-04-05  1:36 ` [PATCH 05/18] staging: lustre: libcfs: make D_HSM a unique value James Simmons
                   ` (13 subsequent siblings)
  17 siblings, 0 replies; 21+ messages in thread
From: James Simmons @ 2016-04-05  1:36 UTC (permalink / raw)
  To: Greg Kroah-Hartman, devel, Andreas Dilger, Oleg Drokin
  Cc: Linux Kernel Mailing List, Lustre Development List,
	Jinshan Xiong, James Simmons

From: Jinshan Xiong <jinshan.xiong@intel.com>

Instead of a using a growing case statement to handle
more debugging options create a array to map debug
flags to string names.

Signed-off-by: Jinshan Xiong <jinshan.xiong@intel.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3647
Reviewed-on: http://review.whamcloud.com/7243
Reviewed-by: John L. Hammond <john.hammond@intel.com>
Reviewed-by: jacques-Charles Lafoucriere <jacques-charles.lafoucriere@cea.fr>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: James Simmons <jsimmons@infradead.org>
---
 .../lustre/include/linux/libcfs/libcfs_debug.h     |   13 ++
 drivers/staging/lustre/lnet/libcfs/debug.c         |  126 ++------------------
 2 files changed, 23 insertions(+), 116 deletions(-)

diff --git a/drivers/staging/lustre/include/linux/libcfs/libcfs_debug.h b/drivers/staging/lustre/include/linux/libcfs/libcfs_debug.h
index 7472a31..5e60c6f 100644
--- a/drivers/staging/lustre/include/linux/libcfs/libcfs_debug.h
+++ b/drivers/staging/lustre/include/linux/libcfs/libcfs_debug.h
@@ -118,6 +118,12 @@ struct ptldebug_header {
 #define S_FID		0x40000000 /* b_new_cmd */
 #define S_FLD		0x80000000 /* b_new_cmd */
 
+#define LIBCFS_DEBUG_SUBSYS_NAMES {					\
+	"undefined", "mdc", "mds", "osc", "ost", "class", "log",	\
+	"llite", "rpc", "mgmt", "lnet", "lnd", "pinger", "filter", "",	\
+	"echo", "ldlm", "lov", "lquota", "osd", "lfsck", "", "", "lmv",	\
+	"", "sec", "gss", "", "mgc", "mgs", "fid", "fld", NULL }
+
 /* Debugging masks (32 bits, non-overlapping) */
 #define D_TRACE		0x00000001 /* ENTRY/EXIT markers */
 #define D_INODE		0x00000002
@@ -151,6 +157,13 @@ struct ptldebug_header {
 
 #define D_HSM	 D_TRACE
 
+#define LIBCFS_DEBUG_MASKS_NAMES {					\
+	"trace", "inode", "super", "ext2", "malloc", "cache", "info",	\
+	"ioctl", "neterror", "net", "warning", "buffs", "other",	\
+	"dentry", "nettrace", "page", "dlmtrace", "error", "emerg",	\
+	"ha", "rpctrace", "vfstrace", "reada", "mmap", "config",	\
+	"console", "quota", "sec", "lfsck", "hsm", NULL }
+
 #define D_CANTMASK   (D_ERROR | D_EMERG | D_WARNING | D_CONSOLE)
 
 #ifndef DEBUG_SUBSYSTEM
diff --git a/drivers/staging/lustre/lnet/libcfs/debug.c b/drivers/staging/lustre/lnet/libcfs/debug.c
index c90e510..4753c32 100644
--- a/drivers/staging/lustre/lnet/libcfs/debug.c
+++ b/drivers/staging/lustre/lnet/libcfs/debug.c
@@ -232,130 +232,24 @@ int libcfs_panic_in_progress;
 static const char *
 libcfs_debug_subsys2str(int subsys)
 {
-	switch (1 << subsys) {
-	default:
+	static const char *libcfs_debug_subsystems[] = LIBCFS_DEBUG_SUBSYS_NAMES;
+
+	if (subsys >= ARRAY_SIZE(libcfs_debug_subsystems))
 		return NULL;
-	case S_UNDEFINED:
-		return "undefined";
-	case S_MDC:
-		return "mdc";
-	case S_MDS:
-		return "mds";
-	case S_OSC:
-		return "osc";
-	case S_OST:
-		return "ost";
-	case S_CLASS:
-		return "class";
-	case S_LOG:
-		return "log";
-	case S_LLITE:
-		return "llite";
-	case S_RPC:
-		return "rpc";
-	case S_LNET:
-		return "lnet";
-	case S_LND:
-		return "lnd";
-	case S_PINGER:
-		return "pinger";
-	case S_FILTER:
-		return "filter";
-	case S_ECHO:
-		return "echo";
-	case S_LDLM:
-		return "ldlm";
-	case S_LOV:
-		return "lov";
-	case S_LQUOTA:
-		return "lquota";
-	case S_OSD:
-		return "osd";
-	case S_LFSCK:
-		return "lfsck";
-	case S_LMV:
-		return "lmv";
-	case S_SEC:
-		return "sec";
-	case S_GSS:
-		return "gss";
-	case S_MGC:
-		return "mgc";
-	case S_MGS:
-		return "mgs";
-	case S_FID:
-		return "fid";
-	case S_FLD:
-		return "fld";
-	}
+
+	return libcfs_debug_subsystems[subsys];
 }
 
 /* libcfs_debug_token2mask() expects the returned string in lower-case */
 static const char *
 libcfs_debug_dbg2str(int debug)
 {
-	switch (1 << debug) {
-	default:
+	static const char *libcfs_debug_masks[] = LIBCFS_DEBUG_MASKS_NAMES;
+
+	if (debug >= ARRAY_SIZE(libcfs_debug_masks))
 		return NULL;
-	case D_TRACE:
-		return "trace";
-	case D_INODE:
-		return "inode";
-	case D_SUPER:
-		return "super";
-	case D_EXT2:
-		return "ext2";
-	case D_MALLOC:
-		return "malloc";
-	case D_CACHE:
-		return "cache";
-	case D_INFO:
-		return "info";
-	case D_IOCTL:
-		return "ioctl";
-	case D_NETERROR:
-		return "neterror";
-	case D_NET:
-		return "net";
-	case D_WARNING:
-		return "warning";
-	case D_BUFFS:
-		return "buffs";
-	case D_OTHER:
-		return "other";
-	case D_DENTRY:
-		return "dentry";
-	case D_NETTRACE:
-		return "nettrace";
-	case D_PAGE:
-		return "page";
-	case D_DLMTRACE:
-		return "dlmtrace";
-	case D_ERROR:
-		return "error";
-	case D_EMERG:
-		return "emerg";
-	case D_HA:
-		return "ha";
-	case D_RPCTRACE:
-		return "rpctrace";
-	case D_VFSTRACE:
-		return "vfstrace";
-	case D_READA:
-		return "reada";
-	case D_MMAP:
-		return "mmap";
-	case D_CONFIG:
-		return "config";
-	case D_CONSOLE:
-		return "console";
-	case D_QUOTA:
-		return "quota";
-	case D_SEC:
-		return "sec";
-	case D_LFSCK:
-		return "lfsck";
-	}
+
+	return libcfs_debug_masks[debug];
 }
 
 int
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH 05/18] staging: lustre: libcfs: make D_HSM a unique value
  2016-04-05  1:36 [PATCH 00/18] fill in missing patches present in 2.4.92 version James Simmons
                   ` (3 preceding siblings ...)
  2016-04-05  1:36 ` [PATCH 04/18] staging: lustre: libcfs: create array of debug names James Simmons
@ 2016-04-05  1:36 ` James Simmons
  2016-04-05  1:36 ` [PATCH 06/18] staging: lustre: hsm: Fix lu_ref for lease handle James Simmons
                   ` (12 subsequent siblings)
  17 siblings, 0 replies; 21+ messages in thread
From: James Simmons @ 2016-04-05  1:36 UTC (permalink / raw)
  To: Greg Kroah-Hartman, devel, Andreas Dilger, Oleg Drokin
  Cc: Linux Kernel Mailing List, Lustre Development List,
	Jinshan Xiong, James Simmons

From: Jinshan Xiong <jinshan.xiong@intel.com>

Redefine D_HSM. It was defined to D_TRACE.

Signed-off-by: Jinshan Xiong <jinshan.xiong@intel.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3647
Reviewed-on: http://review.whamcloud.com/7243
Reviewed-by: John L. Hammond <john.hammond@intel.com>
Reviewed-by: jacques-Charles Lafoucriere <jacques-charles.lafoucriere@cea.fr>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: James Simmons <jsimmons@infradead.org>
---
 .../lustre/include/linux/libcfs/libcfs_debug.h     |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/lustre/include/linux/libcfs/libcfs_debug.h b/drivers/staging/lustre/include/linux/libcfs/libcfs_debug.h
index 5e60c6f..455c54d 100644
--- a/drivers/staging/lustre/include/linux/libcfs/libcfs_debug.h
+++ b/drivers/staging/lustre/include/linux/libcfs/libcfs_debug.h
@@ -154,8 +154,7 @@ struct ptldebug_header {
 #define D_QUOTA		0x04000000
 #define D_SEC		0x08000000
 #define D_LFSCK		0x10000000 /* For both OI scrub and LFSCK */
-
-#define D_HSM	 D_TRACE
+#define D_HSM		0x20000000
 
 #define LIBCFS_DEBUG_MASKS_NAMES {					\
 	"trace", "inode", "super", "ext2", "malloc", "cache", "info",	\
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH 06/18] staging: lustre: hsm: Fix lu_ref for lease handle
  2016-04-05  1:36 [PATCH 00/18] fill in missing patches present in 2.4.92 version James Simmons
                   ` (4 preceding siblings ...)
  2016-04-05  1:36 ` [PATCH 05/18] staging: lustre: libcfs: make D_HSM a unique value James Simmons
@ 2016-04-05  1:36 ` James Simmons
  2016-04-05  1:36 ` [PATCH 07/18] staging: lustre: hsm: rename hai_zero() HSM function James Simmons
                   ` (11 subsequent siblings)
  17 siblings, 0 replies; 21+ messages in thread
From: James Simmons @ 2016-04-05  1:36 UTC (permalink / raw)
  To: Greg Kroah-Hartman, devel, Andreas Dilger, Oleg Drokin
  Cc: Linux Kernel Mailing List, Lustre Development List,
	Jinshan Xiong, James Simmons

From: Jinshan Xiong <jinshan.xiong@intel.com>

The lu_ref was not being decremented when releasing the
lease handle.

Signed-off-by: Jinshan Xiong <jinshan.xiong@intel.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3647
Reviewed-on: http://review.whamcloud.com/7243
Reviewed-by: John L. Hammond <john.hammond@intel.com>
Reviewed-by: jacques-Charles Lafoucriere <jacques-charles.lafoucriere@cea.fr>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: James Simmons <jsimmons@infradead.org>
---
 drivers/staging/lustre/lustre/llite/file.c  |    4 ++--
 drivers/staging/lustre/lustre/mdc/mdc_lib.c |    2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/lustre/lustre/llite/file.c b/drivers/staging/lustre/lustre/llite/file.c
index 02b5783..000ea58 100644
--- a/drivers/staging/lustre/lustre/llite/file.c
+++ b/drivers/staging/lustre/lustre/llite/file.c
@@ -908,7 +908,7 @@ static int ll_lease_close(struct obd_client_handle *och, struct inode *inode,
 		lock_res_and_lock(lock);
 		cancelled = ldlm_is_cancel(lock);
 		unlock_res_and_lock(lock);
-		ldlm_lock_put(lock);
+		LDLM_LOCK_PUT(lock);
 	}
 
 	CDEBUG(D_INODE, "lease for " DFID " broken? %d\n",
@@ -2509,7 +2509,7 @@ ll_file_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
 					rc = och->och_flags &
 						(FMODE_READ | FMODE_WRITE);
 				unlock_res_and_lock(lock);
-				ldlm_lock_put(lock);
+				LDLM_LOCK_PUT(lock);
 			}
 		}
 		mutex_unlock(&lli->lli_och_mutex);
diff --git a/drivers/staging/lustre/lustre/mdc/mdc_lib.c b/drivers/staging/lustre/lustre/mdc/mdc_lib.c
index be0acf7..53cd56f 100644
--- a/drivers/staging/lustre/lustre/mdc/mdc_lib.c
+++ b/drivers/staging/lustre/lustre/mdc/mdc_lib.c
@@ -454,7 +454,7 @@ static void mdc_hsm_release_pack(struct ptlrpc_request *req,
 		lock = ldlm_handle2lock(&op_data->op_lease_handle);
 		if (lock) {
 			data->cd_handle = lock->l_remote_handle;
-			ldlm_lock_put(lock);
+			LDLM_LOCK_PUT(lock);
 		}
 		ldlm_cli_cancel(&op_data->op_lease_handle, LCF_LOCAL);
 
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH 07/18] staging: lustre: hsm: rename hai_zero() HSM function
  2016-04-05  1:36 [PATCH 00/18] fill in missing patches present in 2.4.92 version James Simmons
                   ` (5 preceding siblings ...)
  2016-04-05  1:36 ` [PATCH 06/18] staging: lustre: hsm: Fix lu_ref for lease handle James Simmons
@ 2016-04-05  1:36 ` James Simmons
  2016-04-05  1:36 ` [PATCH 08/18] staging: lustre: hsm: copy start error should set HP_FLAG_COMPLETED James Simmons
                   ` (10 subsequent siblings)
  17 siblings, 0 replies; 21+ messages in thread
From: James Simmons @ 2016-04-05  1:36 UTC (permalink / raw)
  To: Greg Kroah-Hartman, devel, Andreas Dilger, Oleg Drokin
  Cc: Linux Kernel Mailing List, Lustre Development List,
	JC Lafoucriere, James Simmons

From: JC Lafoucriere <jacques-charles.lafoucriere@cea.fr>

rename hai_zero() to hai_first(). Use a better name for hai helper

Signed-off-by: JC Lafoucriere <jacques-charles.lafoucriere@cea.fr>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3709
Reviewed-on: http://review.whamcloud.com/7254
Reviewed-by: Jinshan Xiong <jinshan.xiong@intel.com>
Reviewed-by: John L. Hammond <john.hammond@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: James Simmons <jsimmons@infradead.org>
---
 .../lustre/lustre/include/lustre/lustre_user.h     |    6 +++---
 drivers/staging/lustre/lustre/mdc/mdc_request.c    |    2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/lustre/lustre/include/lustre/lustre_user.h b/drivers/staging/lustre/lustre/include/lustre/lustre_user.h
index 19f2271..4672145 100644
--- a/drivers/staging/lustre/lustre/include/lustre/lustre_user.h
+++ b/drivers/staging/lustre/lustre/include/lustre/lustre_user.h
@@ -1095,7 +1095,7 @@ struct hsm_action_list {
 	__u32 padding1;
 	char  hal_fsname[0];   /* null-terminated */
 	/* struct hsm_action_item[hal_count] follows, aligned on 8-byte
-	 * boundaries. See hai_zero
+	 * boundaries. See hai_first
 	 */
 } __packed;
 
@@ -1109,7 +1109,7 @@ static inline int cfs_size_round(int val)
 #endif
 
 /* Return pointer to first hai in action list */
-static inline struct hsm_action_item *hai_zero(struct hsm_action_list *hal)
+static inline struct hsm_action_item *hai_first(struct hsm_action_list *hal)
 {
 	return (struct hsm_action_item *)(hal->hal_fsname +
 					  cfs_size_round(strlen(hal-> \
@@ -1131,7 +1131,7 @@ static inline int hal_size(struct hsm_action_list *hal)
 	struct hsm_action_item *hai;
 
 	sz = sizeof(*hal) + cfs_size_round(strlen(hal->hal_fsname) + 1);
-	hai = hai_zero(hal);
+	hai = hai_first(hal);
 	for (i = 0; i < hal->hal_count; i++, hai = hai_next(hai))
 		sz += cfs_size_round(hai->hai_len);
 
diff --git a/drivers/staging/lustre/lustre/mdc/mdc_request.c b/drivers/staging/lustre/lustre/mdc/mdc_request.c
index 98b27f1..a089237 100644
--- a/drivers/staging/lustre/lustre/mdc/mdc_request.c
+++ b/drivers/staging/lustre/lustre/mdc/mdc_request.c
@@ -1952,7 +1952,7 @@ static void lustre_swab_hal(struct hsm_action_list *h)
 	__swab32s(&h->hal_count);
 	__swab32s(&h->hal_archive_id);
 	__swab64s(&h->hal_flags);
-	hai = hai_zero(h);
+	hai = hai_first(h);
 	for (i = 0; i < h->hal_count; i++, hai = hai_next(hai))
 		lustre_swab_hai(hai);
 }
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH 08/18] staging: lustre: hsm: copy start error should set HP_FLAG_COMPLETED
  2016-04-05  1:36 [PATCH 00/18] fill in missing patches present in 2.4.92 version James Simmons
                   ` (6 preceding siblings ...)
  2016-04-05  1:36 ` [PATCH 07/18] staging: lustre: hsm: rename hai_zero() HSM function James Simmons
@ 2016-04-05  1:36 ` James Simmons
  2016-04-05  1:36 ` [PATCH 09/18] staging: lustre: lov: Get the correct address of lmm_objects James Simmons
                   ` (9 subsequent siblings)
  17 siblings, 0 replies; 21+ messages in thread
From: James Simmons @ 2016-04-05  1:36 UTC (permalink / raw)
  To: Greg Kroah-Hartman, devel, Andreas Dilger, Oleg Drokin
  Cc: Linux Kernel Mailing List, Lustre Development List,
	Aurelien Degremont, James Simmons

From: Aurelien Degremont <aurelien.degremont@cea.fr>

If an error occurs when initializing a HSM request, in
ll_ioc_copy_start(), the PROGRESS message, sent to coordinator, should
carry the error code but also HP_FLAG_COMPLETED to mark the request as
finished (with error). If not, the Coordinator will ignore this
message and consider the request is still running.

Signed-off-by: Aurelien Degremont <aurelien.degremont@cea.fr>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3685
Reviewed-on: http://review.whamcloud.com/7265
Reviewed-by: Jinshan Xiong <jinshan.xiong@intel.com>
Reviewed-by: John L. Hammond <john.hammond@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: James Simmons <jsimmons@infradead.org>
---
 drivers/staging/lustre/lustre/llite/dir.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/drivers/staging/lustre/lustre/llite/dir.c b/drivers/staging/lustre/lustre/llite/dir.c
index b085fb4..41481cc 100644
--- a/drivers/staging/lustre/lustre/llite/dir.c
+++ b/drivers/staging/lustre/lustre/llite/dir.c
@@ -959,6 +959,9 @@ static int ll_ioc_copy_start(struct super_block *sb, struct hsm_copy *copy)
 	}
 
 progress:
+	/* On error, the request should be considered as completed */
+	if (hpk.hpk_errval > 0)
+		hpk.hpk_flags |= HP_FLAG_COMPLETED;
 	rc = obd_iocontrol(LL_IOC_HSM_PROGRESS, sbi->ll_md_exp, sizeof(hpk),
 			   &hpk, NULL);
 
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH 09/18] staging: lustre: lov: Get the correct address of lmm_objects
  2016-04-05  1:36 [PATCH 00/18] fill in missing patches present in 2.4.92 version James Simmons
                   ` (7 preceding siblings ...)
  2016-04-05  1:36 ` [PATCH 08/18] staging: lustre: hsm: copy start error should set HP_FLAG_COMPLETED James Simmons
@ 2016-04-05  1:36 ` James Simmons
  2016-04-05  1:36 ` [PATCH 10/18] staging: lustre: llite: reset writeback index in ll_writepages James Simmons
                   ` (8 subsequent siblings)
  17 siblings, 0 replies; 21+ messages in thread
From: James Simmons @ 2016-04-05  1:36 UTC (permalink / raw)
  To: Greg Kroah-Hartman, devel, Andreas Dilger, Oleg Drokin
  Cc: Linux Kernel Mailing List, Lustre Development List,
	Swapnil Pimpale, James Simmons

From: Swapnil Pimpale <spimpale@ddn.com>

The introduction of lmm_layout_gen makes the assumption that
lmm_objects is present after lmm_stripe_count incorrect.
Fixed this to get the correct address of lmm_objects when lmmk is cast
to lov_mds_md_v1.

Signed-off-by: Swapnil Pimpale <spimpale@ddn.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3162
Reviewed-on: http://review.whamcloud.com/7258
Reviewed-by: John L. Hammond <john.hammond@intel.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Signed-off-by: James Simmons <jsimmons@infradead.org>
---
 drivers/staging/lustre/lustre/lov/lov_pack.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/lustre/lustre/lov/lov_pack.c b/drivers/staging/lustre/lustre/lov/lov_pack.c
index 3925633..2f02be5 100644
--- a/drivers/staging/lustre/lustre/lov/lov_pack.c
+++ b/drivers/staging/lustre/lustre/lov/lov_pack.c
@@ -444,8 +444,7 @@ int lov_getstripe(struct obd_export *exp, struct lov_stripe_md *lsm,
 	if (lum.lmm_magic == LOV_USER_MAGIC) {
 		/* User request for v1, we need skip lmm_pool_name */
 		if (lmmk->lmm_magic == LOV_MAGIC_V3) {
-			memmove((char *)(&lmmk->lmm_stripe_count) +
-				sizeof(lmmk->lmm_stripe_count),
+			memmove(((struct lov_mds_md_v1 *)lmmk)->lmm_objects,
 				((struct lov_mds_md_v3 *)lmmk)->lmm_objects,
 				lmmk->lmm_stripe_count *
 				sizeof(struct lov_ost_data_v1));
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH 10/18] staging: lustre: llite: reset writeback index in ll_writepages
  2016-04-05  1:36 [PATCH 00/18] fill in missing patches present in 2.4.92 version James Simmons
                   ` (8 preceding siblings ...)
  2016-04-05  1:36 ` [PATCH 09/18] staging: lustre: lov: Get the correct address of lmm_objects James Simmons
@ 2016-04-05  1:36 ` James Simmons
  2016-04-05  1:36 ` [PATCH 11/18] staging: lustre: llite: Delaying creation of client side proc entries James Simmons
                   ` (7 subsequent siblings)
  17 siblings, 0 replies; 21+ messages in thread
From: James Simmons @ 2016-04-05  1:36 UTC (permalink / raw)
  To: Greg Kroah-Hartman, devel, Andreas Dilger, Oleg Drokin
  Cc: Linux Kernel Mailing List, Lustre Development List,
	Jinshan Xiong, James Simmons

From: Jinshan Xiong <jinshan.xiong@intel.com>

Otherwise after one round the writeback index will become beyond
the file size and ->writepages() turns into an empty operation.

Also, a safety guard is added to limit the wait time for grant to
10 minutes(take recovery into consideration) at maximum in the
osc_enter_cache() function. Otherwise, EDQUOT will be returned to
the applications to start sync write.

Signed-off-by: Jinshan Xiong <jinshan.xiong@intel.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3416
Reviewed-on: http://review.whamcloud.com/6554
Reviewed-by: Bobi Jam <bobijam@gmail.com>
Reviewed-by: Niu Yawei <yawei.niu@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: James Simmons <jsimmons@infradead.org>
---
 drivers/staging/lustre/lustre/llite/rw.c      |    5 ++-
 drivers/staging/lustre/lustre/osc/osc_cache.c |   31 +++++++++++++++++--------
 2 files changed, 24 insertions(+), 12 deletions(-)

diff --git a/drivers/staging/lustre/lustre/llite/rw.c b/drivers/staging/lustre/lustre/llite/rw.c
index 7d5dd38..ab490a5 100644
--- a/drivers/staging/lustre/lustre/llite/rw.c
+++ b/drivers/staging/lustre/lustre/llite/rw.c
@@ -1110,8 +1110,9 @@ int ll_writepages(struct address_space *mapping, struct writeback_control *wbc)
 
 	if (wbc->range_cyclic || (range_whole && wbc->nr_to_write > 0)) {
 		if (end == OBD_OBJECT_EOF)
-			end = i_size_read(inode);
-		mapping->writeback_index = (end >> PAGE_CACHE_SHIFT) + 1;
+			mapping->writeback_index = 0;
+		else
+			mapping->writeback_index = (end >> PAGE_CACHE_SHIFT) + 1;
 	}
 	return result;
 }
diff --git a/drivers/staging/lustre/lustre/osc/osc_cache.c b/drivers/staging/lustre/lustre/osc/osc_cache.c
index d01f2a2..f09b89d 100644
--- a/drivers/staging/lustre/lustre/osc/osc_cache.c
+++ b/drivers/staging/lustre/lustre/osc/osc_cache.c
@@ -1379,15 +1379,19 @@ static int osc_completion(const struct lu_env *env, struct osc_async_page *oap,
 	return 0;
 }
 
-#define OSC_DUMP_GRANT(cli, fmt, args...) do {				      \
+#define OSC_DUMP_GRANT(lvl, cli, fmt, args...) do {			\
 	struct client_obd *__tmp = (cli);				      \
-	CDEBUG(D_CACHE, "%s: { dirty: %ld/%ld dirty_pages: %d/%d "	      \
-	       "dropped: %ld avail: %ld, reserved: %ld, flight: %d } " fmt,   \
+	CDEBUG(lvl, "%s: grant { dirty: %ld/%ld dirty_pages: %d/%d "	      \
+	       "dropped: %ld avail: %ld, reserved: %ld, flight: %d } "	\
+	       "lru {in list: %d, left: %d, waiters: %d }" fmt,		\
 	       __tmp->cl_import->imp_obd->obd_name,			      \
 	       __tmp->cl_dirty, __tmp->cl_dirty_max,			      \
 	       atomic_read(&obd_dirty_pages), obd_max_dirty_pages,	      \
 	       __tmp->cl_lost_grant, __tmp->cl_avail_grant,		      \
-	       __tmp->cl_reserved_grant, __tmp->cl_w_in_flight, ##args);      \
+	       __tmp->cl_reserved_grant, __tmp->cl_w_in_flight,		\
+	       atomic_read(&__tmp->cl_lru_in_list),			\
+	       atomic_read(&__tmp->cl_lru_busy),			\
+	       atomic_read(&__tmp->cl_lru_shrinkers), ##args);		\
 } while (0)
 
 /* caller must hold loi_list_lock */
@@ -1527,7 +1531,7 @@ static int osc_enter_cache_try(struct client_obd *cli,
 {
 	int rc;
 
-	OSC_DUMP_GRANT(cli, "need:%d.\n", bytes);
+	OSC_DUMP_GRANT(D_CACHE, cli, "need:%d.\n", bytes);
 
 	rc = osc_reserve_grant(cli, bytes);
 	if (rc < 0)
@@ -1572,10 +1576,11 @@ static int osc_enter_cache(const struct lu_env *env, struct client_obd *cli,
 	struct osc_object *osc = oap->oap_obj;
 	struct lov_oinfo *loi = osc->oo_oinfo;
 	struct osc_cache_waiter ocw;
-	struct l_wait_info lwi = LWI_INTR(LWI_ON_SIGNAL_NOOP, NULL);
+	struct l_wait_info lwi = LWI_TIMEOUT_INTR(cfs_time_seconds(600), NULL,
+						  LWI_ON_SIGNAL_NOOP, NULL);
 	int rc = -EDQUOT;
 
-	OSC_DUMP_GRANT(cli, "need:%d.\n", bytes);
+	OSC_DUMP_GRANT(D_CACHE, cli, "need:%d.\n", bytes);
 
 	spin_lock(&cli->cl_loi_list_lock);
 
@@ -1619,8 +1624,14 @@ static int osc_enter_cache(const struct lu_env *env, struct client_obd *cli,
 
 		spin_lock(&cli->cl_loi_list_lock);
 
-		/* l_wait_event is interrupted by signal */
+		/* l_wait_event is interrupted by signal, or timed out */
 		if (rc < 0) {
+			if (rc == -ETIMEDOUT) {
+				OSC_DUMP_GRANT(D_ERROR, cli,
+					       "try to reserve %d.\n", bytes);
+				osc_extent_tree_dump(D_ERROR, osc);
+				rc = -EDQUOT;
+			}
 			list_del_init(&ocw.ocw_entry);
 			goto out;
 		}
@@ -1637,7 +1648,7 @@ static int osc_enter_cache(const struct lu_env *env, struct client_obd *cli,
 	}
 out:
 	spin_unlock(&cli->cl_loi_list_lock);
-	OSC_DUMP_GRANT(cli, "returned %d.\n", rc);
+	OSC_DUMP_GRANT(D_CACHE, cli, "returned %d.\n", rc);
 	return rc;
 }
 
@@ -3007,7 +3018,7 @@ int osc_cache_writeback_range(const struct lu_env *env, struct osc_object *obj,
 			result = rc;
 	}
 
-	OSC_IO_DEBUG(obj, "cache page out.\n");
+	OSC_IO_DEBUG(obj, "pageout [%lu, %lu], %d.\n", start, end, result);
 	return result;
 }
 
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH 11/18] staging: lustre: llite: Delaying creation of client side proc entries.
  2016-04-05  1:36 [PATCH 00/18] fill in missing patches present in 2.4.92 version James Simmons
                   ` (9 preceding siblings ...)
  2016-04-05  1:36 ` [PATCH 10/18] staging: lustre: llite: reset writeback index in ll_writepages James Simmons
@ 2016-04-05  1:36 ` James Simmons
  2016-04-05  1:36 ` [PATCH 12/18] staging: lustre: mdc: document mdc_rpc_lock James Simmons
                   ` (6 subsequent siblings)
  17 siblings, 0 replies; 21+ messages in thread
From: James Simmons @ 2016-04-05  1:36 UTC (permalink / raw)
  To: Greg Kroah-Hartman, devel, Andreas Dilger, Oleg Drokin
  Cc: Linux Kernel Mailing List, Lustre Development List,
	Gaurav Mahajan, James Simmons

From: Gaurav Mahajan <gmahajan@ddn.com>

In client_common_fill_super() proc entries are created before
before cl_sb_init() and therefore lu_site is not allocated resulting
in client crash when tried reading lu_site stats.
Delaying creation of proc entries after creation of all required data
structures fixed the problem.

Signed-off-by: Gaurav Mahajan <gmahajan@ddn.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-2941
Reviewed-on: http://review.whamcloud.com/6852
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Reviewed-by: Emoly Liu <emoly.liu@intel.com>
Signed-off-by: James Simmons <jsimmons@infradead.org>
---
 drivers/staging/lustre/lustre/llite/llite_lib.c |   16 +++++++++-------
 1 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/drivers/staging/lustre/lustre/llite/llite_lib.c b/drivers/staging/lustre/lustre/llite/llite_lib.c
index 95c55c3..9571742 100644
--- a/drivers/staging/lustre/lustre/llite/llite_lib.c
+++ b/drivers/staging/lustre/lustre/llite/llite_lib.c
@@ -166,12 +166,6 @@ static int client_common_fill_super(struct super_block *sb, char *md, char *dt,
 		return -ENOMEM;
 	}
 
-	if (llite_root) {
-		err = ldebugfs_register_mountpoint(llite_root, sb, dt, md);
-		if (err < 0)
-			CERROR("could not register mount in <debugfs>/lustre/llite\n");
-	}
-
 	/* indicate the features supported by this client */
 	data->ocd_connect_flags = OBD_CONNECT_IBITS    | OBD_CONNECT_NODEVOH  |
 				  OBD_CONNECT_ATTRFID  |
@@ -552,6 +546,15 @@ static int client_common_fill_super(struct super_block *sb, char *md, char *dt,
 	kfree(data);
 	kfree(osfs);
 
+	if (llite_root) {
+		err = ldebugfs_register_mountpoint(llite_root, sb, dt, md);
+		if (err < 0) {
+			CERROR("%s: could not register mount in debugfs: "
+			       "rc = %d\n", ll_get_fsname(sb, NULL, 0), err);
+			err = 0;
+		}
+	}
+
 	return err;
 out_root:
 	iput(root);
@@ -570,7 +573,6 @@ out_md:
 out:
 	kfree(data);
 	kfree(osfs);
-	ldebugfs_unregister_mountpoint(sbi);
 	return err;
 }
 
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH 12/18] staging: lustre: mdc: document mdc_rpc_lock
  2016-04-05  1:36 [PATCH 00/18] fill in missing patches present in 2.4.92 version James Simmons
                   ` (10 preceding siblings ...)
  2016-04-05  1:36 ` [PATCH 11/18] staging: lustre: llite: Delaying creation of client side proc entries James Simmons
@ 2016-04-05  1:36 ` James Simmons
  2016-04-05  1:36 ` [PATCH 13/18] staging: lustre: hsm: Add CLF_RENAME_LAST flag James Simmons
                   ` (5 subsequent siblings)
  17 siblings, 0 replies; 21+ messages in thread
From: James Simmons @ 2016-04-05  1:36 UTC (permalink / raw)
  To: Greg Kroah-Hartman, devel, Andreas Dilger, Oleg Drokin
  Cc: Linux Kernel Mailing List, Lustre Development List, Ned Bass,
	James Simmons

From: Ned Bass <bass6@llnl.gov>

As this lock can be a bottleneck, clarifying why it is needed may be
helpful to those working on client performance.

Signed-off-by: Ned Bass <bass6@llnl.gov>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3443
Reviewed-on: http://review.whamcloud.com/6593
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Reviewed-by: Keith Mannthey <keith.mannthey@intel.com>
Signed-off-by: James Simmons <jsimmons@infradead.org>
---
 drivers/staging/lustre/lustre/include/lustre_mdc.h |   18 ++++++++++++++++++
 1 files changed, 18 insertions(+), 0 deletions(-)

diff --git a/drivers/staging/lustre/lustre/include/lustre_mdc.h b/drivers/staging/lustre/lustre/include/lustre_mdc.h
index df94f9f..9e54790 100644
--- a/drivers/staging/lustre/lustre/include/lustre_mdc.h
+++ b/drivers/staging/lustre/lustre/include/lustre_mdc.h
@@ -64,9 +64,27 @@ struct obd_export;
 struct ptlrpc_request;
 struct obd_device;
 
+/**
+ * Serializes in-flight MDT-modifying RPC requests to preserve idempotency.
+ *
+ * This mutex is used to implement execute-once semantics on the MDT.
+ * The MDT stores the last transaction ID and result for every client in
+ * its last_rcvd file. If the client doesn't get a reply, it can safely
+ * resend the request and the MDT will reconstruct the reply being aware
+ * that the request has already been executed. Without this lock,
+ * execution status of concurrent in-flight requests would be
+ * overwritten.
+ *
+ * This design limits the extent to which we can keep a full pipeline of
+ * in-flight requests from a single client.  This limitation could be
+ * overcome by allowing multiple slots per client in the last_rcvd file.
+ */
 struct mdc_rpc_lock {
+	/** Lock protecting in-flight RPC concurrency. */
 	struct mutex		rpcl_mutex;
+	/** Intent associated with currently executing request. */
 	struct lookup_intent	*rpcl_it;
+	/** Used for MDS/RPC load testing purposes. */
 	int			rpcl_fakes;
 };
 
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH 13/18] staging: lustre: hsm: Add CLF_RENAME_LAST flag
  2016-04-05  1:36 [PATCH 00/18] fill in missing patches present in 2.4.92 version James Simmons
                   ` (11 preceding siblings ...)
  2016-04-05  1:36 ` [PATCH 12/18] staging: lustre: mdc: document mdc_rpc_lock James Simmons
@ 2016-04-05  1:36 ` James Simmons
  2016-04-05  1:36 ` [PATCH 14/18] staging: lustre: fix 'NULL pointer dereference' errors James Simmons
                   ` (4 subsequent siblings)
  17 siblings, 0 replies; 21+ messages in thread
From: James Simmons @ 2016-04-05  1:36 UTC (permalink / raw)
  To: Greg Kroah-Hartman, devel, Andreas Dilger, Oleg Drokin
  Cc: Linux Kernel Mailing List, Lustre Development List,
	JC Lafoucriere, James Simmons

From: JC Lafoucriere <jacques-charles.lafoucriere@cea.fr>

Create a special flag for the last rename event.

Signed-off-by: JC Lafoucriere <jacques-charles.lafoucriere@cea.fr>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3718
Reviewed-on: http://review.whamcloud.com/7260
Reviewed-by: Jinshan Xiong <jinshan.xiong@intel.com>
Reviewed-by: John L. Hammond <john.hammond@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: James Simmons <jsimmons@infradead.org>
---
 .../lustre/lustre/include/lustre/lustre_user.h     |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/drivers/staging/lustre/lustre/include/lustre/lustre_user.h b/drivers/staging/lustre/lustre/include/lustre/lustre_user.h
index 4672145..e4e42e1 100644
--- a/drivers/staging/lustre/lustre/include/lustre/lustre_user.h
+++ b/drivers/staging/lustre/lustre/include/lustre/lustre_user.h
@@ -676,7 +676,12 @@ static inline const char *changelog_type2str(int type)
 #define CLF_UNLINK_HSM_EXISTS 0x0002 /* File has something in HSM */
 				     /* HSM cleaning needed */
 /* Flags for rename */
-#define CLF_RENAME_LAST       0x0001 /* rename unlink last hardlink of target */
+#define CLF_RENAME_LAST		0x0001	/* rename unlink last hardlink of
+					 * target
+					 */
+#define CLF_RENAME_LAST_EXISTS	0x0002	/* rename unlink last hardlink of target
+					 * has an archive in backend
+					 */
 
 /* Flags for HSM */
 /* 12b used (from high weight to low weight):
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH 14/18] staging: lustre: fix 'NULL pointer dereference' errors
  2016-04-05  1:36 [PATCH 00/18] fill in missing patches present in 2.4.92 version James Simmons
                   ` (12 preceding siblings ...)
  2016-04-05  1:36 ` [PATCH 13/18] staging: lustre: hsm: Add CLF_RENAME_LAST flag James Simmons
@ 2016-04-05  1:36 ` James Simmons
  2016-04-05  1:37 ` [PATCH 15/18] staging: lustre: llite: cancel open lock before closing file James Simmons
                   ` (3 subsequent siblings)
  17 siblings, 0 replies; 21+ messages in thread
From: James Simmons @ 2016-04-05  1:36 UTC (permalink / raw)
  To: Greg Kroah-Hartman, devel, Andreas Dilger, Oleg Drokin
  Cc: Linux Kernel Mailing List, Lustre Development List,
	Sebastien Buisson, James Nunez, James Simmons

From: Sebastien Buisson <sbuisson@ddn.com>

Fix 'NULL pointer dereference' defects found by Coverity version
6.5.0:
Dereference after null check (FORWARD_NULL)
For instance, Passing null pointer to a function which dereferences
it.
Dereference before null check (REVERSE_INULL)
Null-checking variable suggests that it may be null, but it has
already been dereferenced on all paths leading to the check.
Dereference null return value (NULL_RETURNS)

Signed-off-by: Sebastien Buisson <sbuisson@ddn.com>
Signed-off-by: James Nunez <james.a.nunez@intel.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3042
Reviewed-on: http://review.whamcloud.com/5868
Reviewed-by: Dmitry Eremin <dmitry.eremin@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: James Simmons <jsimmons@infradead.org>
---
 drivers/staging/lustre/lustre/llite/dir.c  |   10 ++++++----
 drivers/staging/lustre/lustre/lov/lov_io.c |    3 ++-
 2 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/lustre/lustre/llite/dir.c b/drivers/staging/lustre/lustre/llite/dir.c
index 41481cc..7251bef 100644
--- a/drivers/staging/lustre/lustre/llite/dir.c
+++ b/drivers/staging/lustre/lustre/llite/dir.c
@@ -612,15 +612,16 @@ static int ll_readdir(struct file *filp, struct dir_context *ctx)
 	struct inode		*inode	= file_inode(filp);
 	struct ll_file_data	*lfd	= LUSTRE_FPRIVATE(filp);
 	struct ll_sb_info	*sbi	= ll_i2sbi(inode);
+	__u64 pos = lfd ? lfd->lfd_pos : 0;
 	int			hash64	= sbi->ll_flags & LL_SBI_64BIT_HASH;
 	int			api32	= ll_need_32bit_api(sbi);
 	int			rc;
 
 	CDEBUG(D_VFSTRACE, "VFS Op:inode=%lu/%u(%p) pos %lu/%llu 32bit_api %d\n",
 	       inode->i_ino, inode->i_generation,
-	       inode, (unsigned long)lfd->lfd_pos, i_size_read(inode), api32);
+	       inode, (unsigned long)pos, i_size_read(inode), api32);
 
-	if (lfd->lfd_pos == MDS_DIR_END_OFF) {
+	if (pos == MDS_DIR_END_OFF) {
 		/*
 		 * end-of-file.
 		 */
@@ -628,9 +629,10 @@ static int ll_readdir(struct file *filp, struct dir_context *ctx)
 		goto out;
 	}
 
-	ctx->pos = lfd->lfd_pos;
+	ctx->pos = pos;
 	rc = ll_dir_read(inode, ctx);
-	lfd->lfd_pos = ctx->pos;
+	if (lfd)
+		lfd->lfd_pos = ctx->pos;
 	if (ctx->pos == MDS_DIR_END_OFF) {
 		if (api32)
 			ctx->pos = LL_DIR_END_OFF_32BIT;
diff --git a/drivers/staging/lustre/lustre/lov/lov_io.c b/drivers/staging/lustre/lustre/lov/lov_io.c
index 4151237..0b59393 100644
--- a/drivers/staging/lustre/lustre/lov/lov_io.c
+++ b/drivers/staging/lustre/lustre/lov/lov_io.c
@@ -276,10 +276,11 @@ struct lov_io_sub *lov_page_subio(const struct lu_env *env, struct lov_io *lio,
 static int lov_io_subio_init(const struct lu_env *env, struct lov_io *lio,
 			     struct cl_io *io)
 {
-	struct lov_stripe_md *lsm = lio->lis_object->lo_lsm;
+	struct lov_stripe_md *lsm;
 	int result;
 
 	LASSERT(lio->lis_object);
+	lsm = lio->lis_object->lo_lsm;
 
 	/*
 	 * Need to be optimized, we can't afford to allocate a piece of memory
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH 15/18] staging: lustre: llite: cancel open lock before closing file
  2016-04-05  1:36 [PATCH 00/18] fill in missing patches present in 2.4.92 version James Simmons
                   ` (13 preceding siblings ...)
  2016-04-05  1:36 ` [PATCH 14/18] staging: lustre: fix 'NULL pointer dereference' errors James Simmons
@ 2016-04-05  1:37 ` James Simmons
  2016-04-05  1:37 ` [PATCH 16/18] staging: lustre: hsm: Add support to drop all pages for ll_data_version James Simmons
                   ` (2 subsequent siblings)
  17 siblings, 0 replies; 21+ messages in thread
From: James Simmons @ 2016-04-05  1:37 UTC (permalink / raw)
  To: Greg Kroah-Hartman, devel, Andreas Dilger, Oleg Drokin
  Cc: Linux Kernel Mailing List, Lustre Development List,
	Jinshan Xiong, James Simmons

From: Jinshan Xiong <jinshan.xiong@intel.com>

In error handling path of ll_lease_open(), och has already been
freed in ll_close_inode_openhandle() so the sequence of cancel
open lock and close open handle need adjusting.

Signed-off-by: Jinshan Xiong <jinshan.xiong@intel.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3647
Reviewed-on: http://review.whamcloud.com/7346
Reviewed-by: John L. Hammond <john.hammond@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: James Simmons <jsimmons@infradead.org>
---
 drivers/staging/lustre/lustre/llite/file.c |   13 ++++++++-----
 1 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/lustre/lustre/llite/file.c b/drivers/staging/lustre/lustre/llite/file.c
index 000ea58..ac17360 100644
--- a/drivers/staging/lustre/lustre/llite/file.c
+++ b/drivers/staging/lustre/lustre/llite/file.c
@@ -875,16 +875,19 @@ ll_lease_open(struct inode *inode, struct file *file, fmode_t fmode,
 	return och;
 
 out_close:
-	rc2 = ll_close_inode_openhandle(sbi->ll_md_exp, inode, och, NULL);
-	if (rc2)
-		CERROR("Close openhandle returned %d\n", rc2);
-
-	/* cancel open lock */
+	/* Cancel open lock */
 	if (it.d.lustre.it_lock_mode != 0) {
 		ldlm_lock_decref_and_cancel(&och->och_lease_handle,
 					    it.d.lustre.it_lock_mode);
 		it.d.lustre.it_lock_mode = 0;
+		och->och_lease_handle.cookie = 0ULL;
 	}
+	rc2 = ll_close_inode_openhandle(sbi->ll_md_exp, inode, och, NULL);
+	if (rc2 < 0)
+		CERROR("%s: error closing file "DFID": %d\n",
+		       ll_get_fsname(inode->i_sb, NULL, 0),
+		       PFID(&ll_i2info(inode)->lli_fid), rc2);
+	och = NULL; /* och has been freed in ll_close_inode_openhandle() */
 out_release_it:
 	ll_intent_release(&it);
 out:
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH 16/18] staging: lustre: hsm: Add support to drop all pages for ll_data_version
  2016-04-05  1:36 [PATCH 00/18] fill in missing patches present in 2.4.92 version James Simmons
                   ` (14 preceding siblings ...)
  2016-04-05  1:37 ` [PATCH 15/18] staging: lustre: llite: cancel open lock before closing file James Simmons
@ 2016-04-05  1:37 ` James Simmons
  2016-04-05  1:37 ` [PATCH 17/18] staging: lustre: fix 'no effect' errors James Simmons
  2016-04-05  1:37 ` [PATCH 18/18] staging: lustre: osc: Lustre returns EINTR from writes when SA_RESTART is set James Simmons
  17 siblings, 0 replies; 21+ messages in thread
From: James Simmons @ 2016-04-05  1:37 UTC (permalink / raw)
  To: Greg Kroah-Hartman, devel, Andreas Dilger, Oleg Drokin
  Cc: Linux Kernel Mailing List, Lustre Development List,
	Jinshan Xiong, James Simmons

From: Jinshan Xiong <jinshan.xiong@intel.com>

This will be used by HSM release to get data version and drop all
caching pages from all clients, before sending IT_RELEASE close
REQ to MDT.

Signed-off-by: Jinshan Xiong <jinshan.xiong@intel.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3647
Reviewed-on: http://review.whamcloud.com/6794
Reviewed-by: John L. Hammond <john.hammond@intel.com>
Reviewed-by: Aurelien Degremont <aurelien.degremont@cea.fr>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: James Simmons <jsimmons@infradead.org>
---
 .../lustre/lustre/include/lustre/lustre_idl.h      |    1 +
 .../lustre/lustre/include/lustre/lustre_user.h     |    5 +--
 drivers/staging/lustre/lustre/llite/dir.c          |    5 +--
 drivers/staging/lustre/lustre/llite/file.c         |   35 ++++++++++++--------
 .../staging/lustre/lustre/llite/llite_internal.h   |    2 +-
 drivers/staging/lustre/lustre/lov/lov_merge.c      |   11 ++++++
 6 files changed, 38 insertions(+), 21 deletions(-)

diff --git a/drivers/staging/lustre/lustre/include/lustre/lustre_idl.h b/drivers/staging/lustre/lustre/include/lustre/lustre_idl.h
index 12e6718..fa4cbbe 100644
--- a/drivers/staging/lustre/lustre/include/lustre/lustre_idl.h
+++ b/drivers/staging/lustre/lustre/include/lustre/lustre_idl.h
@@ -1428,6 +1428,7 @@ enum obdo_flags {
 					   */
 	OBD_FL_RECOV_RESEND = 0x00080000, /* recoverable resent */
 	OBD_FL_NOSPC_BLK    = 0x00100000, /* no more block space on OST */
+	OBD_FL_FLUSH	    = 0x00200000, /* flush pages on the OST */
 
 	/* Note that while these checksum values are currently separate bits,
 	 * in 2.x we can actually allow all values from 1-31 if we wanted.
diff --git a/drivers/staging/lustre/lustre/include/lustre/lustre_user.h b/drivers/staging/lustre/lustre/include/lustre/lustre_user.h
index e4e42e1..59ba48a 100644
--- a/drivers/staging/lustre/lustre/include/lustre/lustre_user.h
+++ b/drivers/staging/lustre/lustre/include/lustre/lustre_user.h
@@ -838,9 +838,8 @@ struct ioc_data_version {
 	__u64 idv_flags;     /* See LL_DV_xxx */
 };
 
-#define LL_DV_NOFLUSH 0x01   /* Do not take READ EXTENT LOCK before sampling
-			      * version. Dirty caches are left unchanged.
-			      */
+#define LL_DV_RD_FLUSH	BIT(0)	/* Flush dirty pages from clients */
+#define LL_DV_WR_FLUSH	BIT(1)	/* Flush all caching pages from clients */
 
 #ifndef offsetof
 # define offsetof(typ, memb)     ((unsigned long)((char *)&(((typ *)0)->memb)))
diff --git a/drivers/staging/lustre/lustre/llite/dir.c b/drivers/staging/lustre/lustre/llite/dir.c
index 7251bef..45bdf8f 100644
--- a/drivers/staging/lustre/lustre/llite/dir.c
+++ b/drivers/staging/lustre/lustre/llite/dir.c
@@ -941,7 +941,7 @@ static int ll_ioc_copy_start(struct super_block *sb, struct hsm_copy *copy)
 		}
 
 		/* Read current file data version */
-		rc = ll_data_version(inode, &data_version, 1);
+		rc = ll_data_version(inode, &data_version, LL_DV_RD_FLUSH);
 		iput(inode);
 		if (rc != 0) {
 			CDEBUG(D_HSM, "Could not read file data version of "
@@ -1025,8 +1025,7 @@ static int ll_ioc_copy_end(struct super_block *sb, struct hsm_copy *copy)
 			goto progress;
 		}
 
-		rc = ll_data_version(inode, &data_version,
-				     copy->hc_hai.hai_action == HSMA_ARCHIVE);
+		rc = ll_data_version(inode, &data_version, LL_DV_RD_FLUSH);
 		iput(inode);
 		if (rc) {
 			CDEBUG(D_HSM, "Could not read file data version. Request could not be confirmed.\n");
diff --git a/drivers/staging/lustre/lustre/llite/file.c b/drivers/staging/lustre/lustre/llite/file.c
index ac17360..9b553d2 100644
--- a/drivers/staging/lustre/lustre/llite/file.c
+++ b/drivers/staging/lustre/lustre/llite/file.c
@@ -929,7 +929,7 @@ static int ll_lease_close(struct obd_client_handle *och, struct inode *inode,
 
 /* Fills the obdo with the attributes for the lsm */
 static int ll_lsm_getattr(struct lov_stripe_md *lsm, struct obd_export *exp,
-			  struct obdo *obdo, __u64 ioepoch, int sync)
+			  struct obdo *obdo, __u64 ioepoch, int dv_flags)
 {
 	struct ptlrpc_request_set *set;
 	struct obd_info	    oinfo = { };
@@ -948,9 +948,11 @@ static int ll_lsm_getattr(struct lov_stripe_md *lsm, struct obd_export *exp,
 			       OBD_MD_FLMTIME | OBD_MD_FLCTIME |
 			       OBD_MD_FLGROUP | OBD_MD_FLEPOCH |
 			       OBD_MD_FLDATAVERSION;
-	if (sync) {
+	if (dv_flags & (LL_DV_WR_FLUSH | LL_DV_RD_FLUSH)) {
 		oinfo.oi_oa->o_valid |= OBD_MD_FLFLAGS;
 		oinfo.oi_oa->o_flags |= OBD_FL_SRVLOCK;
+		if (dv_flags & LL_DV_WR_FLUSH)
+			oinfo.oi_oa->o_flags |= OBD_FL_FLUSH;
 	}
 
 	set = ptlrpc_prep_set();
@@ -963,11 +965,16 @@ static int ll_lsm_getattr(struct lov_stripe_md *lsm, struct obd_export *exp,
 			rc = ptlrpc_set_wait(set);
 		ptlrpc_set_destroy(set);
 	}
-	if (rc == 0)
+	if (rc == 0) {
 		oinfo.oi_oa->o_valid &= (OBD_MD_FLBLOCKS | OBD_MD_FLBLKSZ |
 					 OBD_MD_FLATIME | OBD_MD_FLMTIME |
 					 OBD_MD_FLCTIME | OBD_MD_FLSIZE |
-					 OBD_MD_FLDATAVERSION);
+					 OBD_MD_FLDATAVERSION | OBD_MD_FLFLAGS);
+		if (dv_flags & LL_DV_WR_FLUSH &&
+		    !(oinfo.oi_oa->o_valid & OBD_MD_FLFLAGS &&
+		      oinfo.oi_oa->o_flags & OBD_FL_FLUSH))
+			return -ENOTSUPP;
+	}
 	return rc;
 }
 
@@ -983,7 +990,7 @@ int ll_inode_getattr(struct inode *inode, struct obdo *obdo,
 
 	lsm = ccc_inode_lsm_get(inode);
 	rc = ll_lsm_getattr(lsm, ll_i2dtexp(inode),
-			    obdo, ioepoch, sync);
+			    obdo, ioepoch, sync ? LL_DV_RD_FLUSH : 0);
 	if (rc == 0) {
 		struct ost_id *oi = lsm ? &lsm->lsm_oi : &obdo->o_oi;
 
@@ -1874,11 +1881,12 @@ error:
  * This value is computed using stripe object version on OST.
  * Version is computed using server side locking.
  *
- * @param extent_lock  Take extent lock. Not needed if a process is already
- *		       holding the OST object group locks.
+ * @param sync  if do sync on the OST side;
+ *		0: no sync
+ *		LL_DV_RD_FLUSH: flush dirty pages, LCK_PR on OSTs
+ *		LL_DV_WR_FLUSH: drop all caching pages, LCK_PW on OSTs
  */
-int ll_data_version(struct inode *inode, __u64 *data_version,
-		    int extent_lock)
+int ll_data_version(struct inode *inode, __u64 *data_version, int flags)
 {
 	struct lov_stripe_md	*lsm = NULL;
 	struct ll_sb_info	*sbi = ll_i2sbi(inode);
@@ -1900,7 +1908,7 @@ int ll_data_version(struct inode *inode, __u64 *data_version,
 		goto out;
 	}
 
-	rc = ll_lsm_getattr(lsm, sbi->ll_dt_exp, obdo, 0, extent_lock);
+	rc = ll_lsm_getattr(lsm, sbi->ll_dt_exp, obdo, 0, flags);
 	if (rc == 0) {
 		if (!(obdo->o_valid & OBD_MD_FLDATAVERSION))
 			rc = -EOPNOTSUPP;
@@ -1936,7 +1944,7 @@ int ll_hsm_release(struct inode *inode)
 	}
 
 	/* Grab latest data_version and [am]time values */
-	rc = ll_data_version(inode, &data_version, 1);
+	rc = ll_data_version(inode, &data_version, LL_DV_WR_FLUSH);
 	if (rc != 0)
 		goto out;
 
@@ -2344,9 +2352,8 @@ ll_file_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
 		if (copy_from_user(&idv, (char __user *)arg, sizeof(idv)))
 			return -EFAULT;
 
-		rc = ll_data_version(inode, &idv.idv_version,
-				     !(idv.idv_flags & LL_DV_NOFLUSH));
-
+		idv.idv_flags &= LL_DV_RD_FLUSH | LL_DV_WR_FLUSH;
+		rc = ll_data_version(inode, &idv.idv_version, idv.idv_flags);
 		if (rc == 0 && copy_to_user((char __user *)arg, &idv,
 					    sizeof(idv)))
 			return -EFAULT;
diff --git a/drivers/staging/lustre/lustre/llite/llite_internal.h b/drivers/staging/lustre/lustre/llite/llite_internal.h
index ccbb9be..d67c8c0 100644
--- a/drivers/staging/lustre/lustre/llite/llite_internal.h
+++ b/drivers/staging/lustre/lustre/llite/llite_internal.h
@@ -757,7 +757,7 @@ int ll_dir_getstripe(struct inode *inode, struct lov_mds_md **lmmp,
 int ll_fsync(struct file *file, loff_t start, loff_t end, int data);
 int ll_merge_attr(const struct lu_env *env, struct inode *inode);
 int ll_fid2path(struct inode *inode, void __user *arg);
-int ll_data_version(struct inode *inode, __u64 *data_version, int extent_lock);
+int ll_data_version(struct inode *inode, __u64 *data_version, int flags);
 int ll_hsm_release(struct inode *inode);
 
 /* llite/dcache.c */
diff --git a/drivers/staging/lustre/lustre/lov/lov_merge.c b/drivers/staging/lustre/lustre/lov/lov_merge.c
index 029cd4d..56ef41d 100644
--- a/drivers/staging/lustre/lustre/lov/lov_merge.c
+++ b/drivers/staging/lustre/lustre/lov/lov_merge.c
@@ -154,6 +154,7 @@ void lov_merge_attrs(struct obdo *tgt, struct obdo *src, u64 valid,
 	valid &= src->o_valid;
 
 	if (*set) {
+		tgt->o_valid &= valid;
 		if (valid & OBD_MD_FLSIZE) {
 			/* this handles sparse files properly */
 			u64 lov_size;
@@ -172,12 +173,22 @@ void lov_merge_attrs(struct obdo *tgt, struct obdo *src, u64 valid,
 			tgt->o_mtime = src->o_mtime;
 		if (valid & OBD_MD_FLDATAVERSION)
 			tgt->o_data_version += src->o_data_version;
+
+		/* handle flags */
+		if (valid & OBD_MD_FLFLAGS)
+			tgt->o_flags &= src->o_flags;
+		else
+			tgt->o_flags = 0;
 	} else {
 		memcpy(tgt, src, sizeof(*tgt));
 		tgt->o_oi = lsm->lsm_oi;
+		tgt->o_valid = valid;
 		if (valid & OBD_MD_FLSIZE)
 			tgt->o_size = lov_stripe_size(lsm, src->o_size,
 						      stripeno);
+		tgt->o_flags = 0;
+		if (valid & OBD_MD_FLFLAGS)
+			tgt->o_flags = src->o_flags;
 	}
 
 	/* data_version needs to be valid on all stripes to be correct! */
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH 17/18] staging: lustre: fix 'no effect' errors
  2016-04-05  1:36 [PATCH 00/18] fill in missing patches present in 2.4.92 version James Simmons
                   ` (15 preceding siblings ...)
  2016-04-05  1:37 ` [PATCH 16/18] staging: lustre: hsm: Add support to drop all pages for ll_data_version James Simmons
@ 2016-04-05  1:37 ` James Simmons
  2016-04-05  1:37 ` [PATCH 18/18] staging: lustre: osc: Lustre returns EINTR from writes when SA_RESTART is set James Simmons
  17 siblings, 0 replies; 21+ messages in thread
From: James Simmons @ 2016-04-05  1:37 UTC (permalink / raw)
  To: Greg Kroah-Hartman, devel, Andreas Dilger, Oleg Drokin
  Cc: Linux Kernel Mailing List, Lustre Development List,
	Sebastien Buisson, James Simmons

From: Sebastien Buisson <sbuisson@ddn.com>

Fix 'no effect' issues found by Coverity version 6.5.1:

Unsigned compared against 0 (NO_EFFECT)
This greater-than-or-equal-to-zero comparison of an unsigned value
is always true.

Remove useless cast.

Signed-off-by: Sebastien Buisson <sbuisson@ddn.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3907
Reviewed-on: http://review.whamcloud.com/7166
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: James Simmons <jsimmons@infradead.org>
---
 drivers/staging/lustre/lustre/llite/xattr.c |    3 +--
 drivers/staging/lustre/lustre/lmv/lmv_obd.c |    2 +-
 2 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/lustre/lustre/llite/xattr.c b/drivers/staging/lustre/lustre/llite/xattr.c
index 6282478..6589108 100644
--- a/drivers/staging/lustre/lustre/llite/xattr.c
+++ b/drivers/staging/lustre/lustre/llite/xattr.c
@@ -423,8 +423,7 @@ getxattr_nocache:
 	if (rce && rce->rce_ops == RMT_LSETFACL) {
 		ext_acl_xattr_header *acl;
 
-		acl = lustre_posix_acl_xattr_2ext(
-					(posix_acl_xattr_header *)buffer, rc);
+		acl = lustre_posix_acl_xattr_2ext(buffer, rc);
 		if (IS_ERR(acl)) {
 			rc = PTR_ERR(acl);
 			goto out;
diff --git a/drivers/staging/lustre/lustre/lmv/lmv_obd.c b/drivers/staging/lustre/lustre/lmv/lmv_obd.c
index 8bd2dc5..3969732 100644
--- a/drivers/staging/lustre/lustre/lmv/lmv_obd.c
+++ b/drivers/staging/lustre/lustre/lmv/lmv_obd.c
@@ -926,7 +926,7 @@ static int lmv_iocontrol(unsigned int cmd, struct obd_export *exp,
 		struct obd_quotactl *oqctl;
 
 		if (qctl->qc_valid == QC_MDTIDX) {
-			if (qctl->qc_idx < 0 || count <= qctl->qc_idx)
+			if (count <= qctl->qc_idx)
 				return -EINVAL;
 
 			tgt = lmv->tgts[qctl->qc_idx];
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH 18/18] staging: lustre: osc: Lustre returns EINTR from writes when SA_RESTART is set
  2016-04-05  1:36 [PATCH 00/18] fill in missing patches present in 2.4.92 version James Simmons
                   ` (16 preceding siblings ...)
  2016-04-05  1:37 ` [PATCH 17/18] staging: lustre: fix 'no effect' errors James Simmons
@ 2016-04-05  1:37 ` James Simmons
  2016-04-12  3:54   ` Greg Kroah-Hartman
  17 siblings, 1 reply; 21+ messages in thread
From: James Simmons @ 2016-04-05  1:37 UTC (permalink / raw)
  To: Greg Kroah-Hartman, devel, Andreas Dilger, Oleg Drokin
  Cc: Linux Kernel Mailing List, Lustre Development List,
	James Simmons, Patrick Farrell, James Simmons

When Lustre is in a read or write system call and receives a
SIGALRM, it will return EINTR if interrupted in osc_enter_cache.
This prevents the system call from being restarted if
SA_RESTART is set in the handler.

This patch changes behavior in this location to return ERESTARTSYS
when a signal arrives during the call to l_wait_event.

Signed-off-by: Patrick Farrell <paf@cray.com>
Signed-off-by: James Simmons <uja.ornl@gmail.com>
ntel-bug-id: https://jira.hpdd.intel.com/browse/LU-3581
Reviewed-on: http://review.whamcloud.com/7002
Reviewed-by: Rahul Deshmukh <rahul_deshmukh@xyratex.com>
Reviewed-by: Cory Spitz <spitzcor@cray.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Signed-off-by: James Simmons <jsimmons@infradead.org>
---
 drivers/staging/lustre/lustre/osc/osc_cache.c |   13 ++++++++++++-
 1 files changed, 12 insertions(+), 1 deletions(-)

diff --git a/drivers/staging/lustre/lustre/osc/osc_cache.c b/drivers/staging/lustre/lustre/osc/osc_cache.c
index f09b89d..956d57b 100644
--- a/drivers/staging/lustre/lustre/osc/osc_cache.c
+++ b/drivers/staging/lustre/lustre/osc/osc_cache.c
@@ -1626,11 +1626,22 @@ static int osc_enter_cache(const struct lu_env *env, struct client_obd *cli,
 
 		/* l_wait_event is interrupted by signal, or timed out */
 		if (rc < 0) {
-			if (rc == -ETIMEDOUT) {
+			switch (rc) {
+			case -ETIMEDOUT:
 				OSC_DUMP_GRANT(D_ERROR, cli,
 					       "try to reserve %d.\n", bytes);
 				osc_extent_tree_dump(D_ERROR, osc);
 				rc = -EDQUOT;
+				break;
+			case -EINTR:
+				/* Ensures restartability - LU-3581 */
+				rc = -ERESTARTSYS;
+				break;
+			default:
+				CDEBUG(D_CACHE, "%s: event for cache space @ %p never arrived due to %d\n",
+				       cli->cl_import->imp_obd->obd_name,
+				       &ocw, rc);
+				break;
 			}
 			list_del_init(&ocw.ocw_entry);
 			goto out;
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* Re: [PATCH 18/18] staging: lustre: osc: Lustre returns EINTR from writes when SA_RESTART is set
  2016-04-05  1:37 ` [PATCH 18/18] staging: lustre: osc: Lustre returns EINTR from writes when SA_RESTART is set James Simmons
@ 2016-04-12  3:54   ` Greg Kroah-Hartman
  2016-04-12 17:21     ` James Simmons
  0 siblings, 1 reply; 21+ messages in thread
From: Greg Kroah-Hartman @ 2016-04-12  3:54 UTC (permalink / raw)
  To: James Simmons
  Cc: devel, Andreas Dilger, Oleg Drokin, Linux Kernel Mailing List,
	Lustre Development List, Patrick Farrell, James Simmons

Some of this series didn't apply, due to merge issues with 4.6-rc3.  Can
you rebase and resend the remaining patches?

thanks,

greg k-h

On Mon, Apr 04, 2016 at 09:37:03PM -0400, James Simmons wrote:
> When Lustre is in a read or write system call and receives a
> SIGALRM, it will return EINTR if interrupted in osc_enter_cache.
> This prevents the system call from being restarted if
> SA_RESTART is set in the handler.
> 
> This patch changes behavior in this location to return ERESTARTSYS
> when a signal arrives during the call to l_wait_event.
> 
> Signed-off-by: Patrick Farrell <paf@cray.com>
> Signed-off-by: James Simmons <uja.ornl@gmail.com>
> ntel-bug-id: https://jira.hpdd.intel.com/browse/LU-3581
> Reviewed-on: http://review.whamcloud.com/7002
> Reviewed-by: Rahul Deshmukh <rahul_deshmukh@xyratex.com>
> Reviewed-by: Cory Spitz <spitzcor@cray.com>
> Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
> Signed-off-by: James Simmons <jsimmons@infradead.org>
> ---
>  drivers/staging/lustre/lustre/osc/osc_cache.c |   13 ++++++++++++-
>  1 files changed, 12 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/staging/lustre/lustre/osc/osc_cache.c b/drivers/staging/lustre/lustre/osc/osc_cache.c
> index f09b89d..956d57b 100644
> --- a/drivers/staging/lustre/lustre/osc/osc_cache.c
> +++ b/drivers/staging/lustre/lustre/osc/osc_cache.c
> @@ -1626,11 +1626,22 @@ static int osc_enter_cache(const struct lu_env *env, struct client_obd *cli,
>  
>  		/* l_wait_event is interrupted by signal, or timed out */
>  		if (rc < 0) {
> -			if (rc == -ETIMEDOUT) {
> +			switch (rc) {
> +			case -ETIMEDOUT:
>  				OSC_DUMP_GRANT(D_ERROR, cli,
>  					       "try to reserve %d.\n", bytes);
>  				osc_extent_tree_dump(D_ERROR, osc);
>  				rc = -EDQUOT;
> +				break;
> +			case -EINTR:
> +				/* Ensures restartability - LU-3581 */
> +				rc = -ERESTARTSYS;
> +				break;
> +			default:
> +				CDEBUG(D_CACHE, "%s: event for cache space @ %p never arrived due to %d\n",
> +				       cli->cl_import->imp_obd->obd_name,
> +				       &ocw, rc);
> +				break;
>  			}
>  			list_del_init(&ocw.ocw_entry);
>  			goto out;
> -- 
> 1.7.1

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH 18/18] staging: lustre: osc: Lustre returns EINTR from writes when SA_RESTART is set
  2016-04-12  3:54   ` Greg Kroah-Hartman
@ 2016-04-12 17:21     ` James Simmons
  0 siblings, 0 replies; 21+ messages in thread
From: James Simmons @ 2016-04-12 17:21 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: devel, Andreas Dilger, Oleg Drokin, Linux Kernel Mailing List,
	Lustre Development List, Patrick Farrell, James Simmons


> Some of this series didn't apply, due to merge issues with 4.6-rc3.  Can
> you rebase and resend the remaining patches?

This patch conflicts with a patch landed from Oleg which is a better 
solution for this bug. We can drop this patch.

> 
> thanks,
> 
> greg k-h
> 
> On Mon, Apr 04, 2016 at 09:37:03PM -0400, James Simmons wrote:
> > When Lustre is in a read or write system call and receives a
> > SIGALRM, it will return EINTR if interrupted in osc_enter_cache.
> > This prevents the system call from being restarted if
> > SA_RESTART is set in the handler.
> > 
> > This patch changes behavior in this location to return ERESTARTSYS
> > when a signal arrives during the call to l_wait_event.
> > 
> > Signed-off-by: Patrick Farrell <paf@cray.com>
> > Signed-off-by: James Simmons <uja.ornl@gmail.com>
> > ntel-bug-id: https://jira.hpdd.intel.com/browse/LU-3581
> > Reviewed-on: http://review.whamcloud.com/7002
> > Reviewed-by: Rahul Deshmukh <rahul_deshmukh@xyratex.com>
> > Reviewed-by: Cory Spitz <spitzcor@cray.com>
> > Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
> > Signed-off-by: James Simmons <jsimmons@infradead.org>
> > ---
> >  drivers/staging/lustre/lustre/osc/osc_cache.c |   13 ++++++++++++-
> >  1 files changed, 12 insertions(+), 1 deletions(-)
> > 
> > diff --git a/drivers/staging/lustre/lustre/osc/osc_cache.c b/drivers/staging/lustre/lustre/osc/osc_cache.c
> > index f09b89d..956d57b 100644
> > --- a/drivers/staging/lustre/lustre/osc/osc_cache.c
> > +++ b/drivers/staging/lustre/lustre/osc/osc_cache.c
> > @@ -1626,11 +1626,22 @@ static int osc_enter_cache(const struct lu_env *env, struct client_obd *cli,
> >  
> >  		/* l_wait_event is interrupted by signal, or timed out */
> >  		if (rc < 0) {
> > -			if (rc == -ETIMEDOUT) {
> > +			switch (rc) {
> > +			case -ETIMEDOUT:
> >  				OSC_DUMP_GRANT(D_ERROR, cli,
> >  					       "try to reserve %d.\n", bytes);
> >  				osc_extent_tree_dump(D_ERROR, osc);
> >  				rc = -EDQUOT;
> > +				break;
> > +			case -EINTR:
> > +				/* Ensures restartability - LU-3581 */
> > +				rc = -ERESTARTSYS;
> > +				break;
> > +			default:
> > +				CDEBUG(D_CACHE, "%s: event for cache space @ %p never arrived due to %d\n",
> > +				       cli->cl_import->imp_obd->obd_name,
> > +				       &ocw, rc);
> > +				break;
> >  			}
> >  			list_del_init(&ocw.ocw_entry);
> >  			goto out;
> > -- 
> > 1.7.1
> 

^ permalink raw reply	[flat|nested] 21+ messages in thread

end of thread, other threads:[~2016-04-12 17:21 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-04-05  1:36 [PATCH 00/18] fill in missing patches present in 2.4.92 version James Simmons
2016-04-05  1:36 ` [PATCH 01/18] staging: lustre: ldlm: fix 'deadcode' errors James Simmons
2016-04-05  1:36 ` [PATCH 02/18] staging: lustre: llite: use 64bits flags in ll_lov_setea() James Simmons
2016-04-05  1:36 ` [PATCH 03/18] staging: lustre: libcfs: remove userland comments in libcfs_debug.h James Simmons
2016-04-05  1:36 ` [PATCH 04/18] staging: lustre: libcfs: create array of debug names James Simmons
2016-04-05  1:36 ` [PATCH 05/18] staging: lustre: libcfs: make D_HSM a unique value James Simmons
2016-04-05  1:36 ` [PATCH 06/18] staging: lustre: hsm: Fix lu_ref for lease handle James Simmons
2016-04-05  1:36 ` [PATCH 07/18] staging: lustre: hsm: rename hai_zero() HSM function James Simmons
2016-04-05  1:36 ` [PATCH 08/18] staging: lustre: hsm: copy start error should set HP_FLAG_COMPLETED James Simmons
2016-04-05  1:36 ` [PATCH 09/18] staging: lustre: lov: Get the correct address of lmm_objects James Simmons
2016-04-05  1:36 ` [PATCH 10/18] staging: lustre: llite: reset writeback index in ll_writepages James Simmons
2016-04-05  1:36 ` [PATCH 11/18] staging: lustre: llite: Delaying creation of client side proc entries James Simmons
2016-04-05  1:36 ` [PATCH 12/18] staging: lustre: mdc: document mdc_rpc_lock James Simmons
2016-04-05  1:36 ` [PATCH 13/18] staging: lustre: hsm: Add CLF_RENAME_LAST flag James Simmons
2016-04-05  1:36 ` [PATCH 14/18] staging: lustre: fix 'NULL pointer dereference' errors James Simmons
2016-04-05  1:37 ` [PATCH 15/18] staging: lustre: llite: cancel open lock before closing file James Simmons
2016-04-05  1:37 ` [PATCH 16/18] staging: lustre: hsm: Add support to drop all pages for ll_data_version James Simmons
2016-04-05  1:37 ` [PATCH 17/18] staging: lustre: fix 'no effect' errors James Simmons
2016-04-05  1:37 ` [PATCH 18/18] staging: lustre: osc: Lustre returns EINTR from writes when SA_RESTART is set James Simmons
2016-04-12  3:54   ` Greg Kroah-Hartman
2016-04-12 17:21     ` James Simmons

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).