linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 00/39] staging/lustre: patch bomb 2
@ 2013-11-14 16:32 Peng Tao
  2013-11-14 16:32 ` [PATCH 01/39] staging/lustre/hsm: remove hsm_nl proc file Peng Tao
                   ` (38 more replies)
  0 siblings, 39 replies; 42+ messages in thread
From: Peng Tao @ 2013-11-14 16:32 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-kernel, Peng Tao, Andreas Dilger

Hi Greg,

This is the second patch bomb. All 39 patches are ported from Lustre tree.
And it syncs kernel client with Lustre tree up to commit
(LU-3581 osc: Lustre returns EINTR from writes when SA_RESTART is set).

Thanks,
Tao

Cc: Andreas Dilger <andreas.dilger@intel.com>

Andreas Dilger (1):
  staging/lustre/osd-ldiskfs: remove dependency on mdd module

Andriy Skulysh (2):
  staging/lustre/ptlrpc: add rpc_cache
  staging/lustre/ldlm: ldlm_flock_deadlock() ASSERTION( req != lock )
    failed

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

Bob Glossman (1):
  staging/lustre/libcfs: improve validity test for valid file
    descriptors

Christopher J. Morrone (1):
  staging/lustre/changelogs: Account for changelog_ext_rec in
    CR_MAXSIZE

Dmitry Eremin (2):
  staging/lustre/lnet: build Lustre with Intel OFED for Xeon Phi
  staging/lustre/build: build error with gcc 4.7.0 20110509

Fan Yong (1):
  staging/lustre/llite: return compatible fsid for statfs

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

Henri Doreau (1):
  staging/lustre/utils: Posix copytool fixes.

JC Lafoucriere (3):
  staging/lustre/mdt: CDT cleanup follow-on patch
  staging/lustre/lmv: update coding style
  staging/lustre/mdt: HSM EXIST event not triggered at last rm/mv

James Simmons (5):
  staging/lustre/lvfs: remove llog_lvfs.c and other lvfs code from llog
  staging/lustre/autoconf: remove LC_LOCK_MAP_ACQUIRE test
  staging/lustre/autoconf: remove LC_FS_STRUCT_USE_PATH
  staging/lustre/autoconf: remove LC_SECURITY_PLUG test
  staging/lustre/osc: Lustre returns EINTR from writes when SA_RESTART
    is set

Jinshan Xiong (4):
  staging/lustre/hsm: small fixes for HSM
  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

John L. Hammond (3):
  staging/lustre/hsm: remove hsm_nl proc file
  staging/lustre/clio: honor O_NOATIME
  staging/lustre/obd: add md_stats to MDC and LMV devices

Li Xi (1):
  staging/lustre/libcfs: Add relocation function to libcfs heap

Mikhail Pershin (1):
  staging/lustre/obdclass: fix wrong device put in case of race

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 (5):
  staging/lustre/build: fix 'deadcode' errors
  staging/lustre/build: fix 'integer handling' issues
  staging/lustre/build: fix 'data race condition' issues
  staging/lustre/build: fix 'NULL pointer dereference' errors
  staging/lustre/build: fix 'no effect' errors

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

Vitaly Fertman (1):
  staging/lustre/clio: wrong cl_lock usage

wang di (2):
  staging/lustre/lmv: choose right MDT for open by FID
  staging/lustre/osd: remove fld lookup during configuration

 .../lustre/include/linux/libcfs/libcfs_debug.h     |  129 +--
 .../lustre/include/linux/libcfs/libcfs_heap.h      |    1 +
 .../include/linux/libcfs/libcfs_kernelcomm.h       |    1 +
 .../staging/lustre/lnet/klnds/o2iblnd/o2iblnd.h    |    2 +
 drivers/staging/lustre/lnet/selftest/conrpc.c      |    8 +-
 drivers/staging/lustre/lustre/include/cl_object.h  |    6 +-
 .../lustre/lustre/include/linux/lustre_compat25.h  |   14 -
 .../lustre/lustre/include/linux/lustre_fsfilt.h    |   84 --
 drivers/staging/lustre/lustre/include/linux/lvfs.h |    5 -
 .../lustre/lustre/include/lustre/lustre_idl.h      |    8 +-
 .../lustre/lustre/include/lustre/lustre_user.h     |   16 +-
 .../lustre/lustre/include/lustre/lustreapi.h       |    7 +-
 .../staging/lustre/lustre/include/lustre_capa.h    |   25 +-
 .../staging/lustre/lustre/include/lustre_export.h  |    1 -
 drivers/staging/lustre/lustre/include/lustre_log.h |    4 -
 drivers/staging/lustre/lustre/include/lustre_mdc.h |   18 +
 .../staging/lustre/lustre/include/lustre_update.h  |    3 +-
 drivers/staging/lustre/lustre/include/md_object.h  |   20 -
 drivers/staging/lustre/lustre/include/obd.h        |  139 ++--
 drivers/staging/lustre/lustre/include/obd_class.h  |  129 ++-
 drivers/staging/lustre/lustre/ldlm/ldlm_flock.c    |    3 +
 drivers/staging/lustre/lustre/libcfs/debug.c       |  131 +--
 drivers/staging/lustre/lustre/libcfs/heap.c        |   18 +-
 .../lustre/lustre/libcfs/kernel_user_comm.c        |   10 +-
 .../lustre/lustre/libcfs/linux/linux-curproc.c     |    4 +-
 drivers/staging/lustre/lustre/llite/dir.c          |   30 +-
 drivers/staging/lustre/lustre/llite/file.c         |   98 ++-
 .../staging/lustre/lustre/llite/llite_internal.h   |    6 +-
 drivers/staging/lustre/lustre/llite/llite_lib.c    |   25 +-
 drivers/staging/lustre/lustre/llite/llite_nfs.c    |   16 -
 drivers/staging/lustre/lustre/llite/rw.c           |    6 +-
 drivers/staging/lustre/lustre/llite/xattr.c        |   11 +-
 drivers/staging/lustre/lustre/lmv/lmv_intent.c     |    8 +-
 drivers/staging/lustre/lustre/lmv/lmv_obd.c        |  115 +--
 drivers/staging/lustre/lustre/lov/lov_io.c         |    4 +-
 drivers/staging/lustre/lustre/lov/lov_merge.c      |   13 +-
 drivers/staging/lustre/lustre/lov/lov_obd.c        |    2 +-
 drivers/staging/lustre/lustre/lov/lov_pack.c       |    3 +-
 drivers/staging/lustre/lustre/lvfs/fsfilt_ext3.c   |  760 ------------------
 drivers/staging/lustre/lustre/lvfs/lvfs_lib.c      |    6 +
 drivers/staging/lustre/lustre/lvfs/lvfs_linux.c    |   17 +-
 drivers/staging/lustre/lustre/mdc/lproc_mdc.c      |   73 --
 drivers/staging/lustre/lustre/mdc/mdc_lib.c        |    2 +-
 drivers/staging/lustre/lustre/mdc/mdc_request.c    |   10 +-
 drivers/staging/lustre/lustre/obdclass/capa.c      |   41 +
 drivers/staging/lustre/lustre/obdclass/cl_lock.c   |    2 +-
 drivers/staging/lustre/lustre/obdclass/class_obd.c |    5 +
 drivers/staging/lustre/lustre/obdclass/llog_cat.c  |   34 +-
 .../staging/lustre/lustre/obdclass/llog_ioctl.c    |    6 +-
 drivers/staging/lustre/lustre/obdclass/llog_lvfs.c |  847 --------------------
 .../staging/lustre/lustre/obdclass/local_storage.c |   13 +-
 .../lustre/lustre/obdclass/lprocfs_status.c        |   58 +-
 drivers/staging/lustre/lustre/osc/osc_cache.c      |   43 +-
 drivers/staging/lustre/lustre/osc/osc_io.c         |   21 +-
 drivers/staging/lustre/lustre/osc/osc_lock.c       |   19 +-
 drivers/staging/lustre/lustre/ptlrpc/client.c      |   42 +-
 drivers/staging/lustre/lustre/ptlrpc/events.c      |    2 +-
 .../staging/lustre/lustre/ptlrpc/ptlrpc_internal.h |    4 +
 .../staging/lustre/lustre/ptlrpc/ptlrpc_module.c   |   24 +-
 drivers/staging/lustre/lustre/ptlrpc/sec.c         |    6 +-
 drivers/staging/lustre/lustre/ptlrpc/sec_bulk.c    |    1 -
 drivers/staging/lustre/lustre/ptlrpc/sec_config.c  |    2 +-
 drivers/staging/lustre/lustre/ptlrpc/service.c     |   13 +-
 63 files changed, 772 insertions(+), 2402 deletions(-)
 delete mode 100644 drivers/staging/lustre/lustre/lvfs/fsfilt_ext3.c
 delete mode 100644 drivers/staging/lustre/lustre/obdclass/llog_lvfs.c

-- 
1.7.9.5


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

* [PATCH 01/39] staging/lustre/hsm: remove hsm_nl proc file
  2013-11-14 16:32 [PATCH 00/39] staging/lustre: patch bomb 2 Peng Tao
@ 2013-11-14 16:32 ` Peng Tao
  2013-11-15  4:26   ` Greg Kroah-Hartman
  2013-11-14 16:32 ` [PATCH 02/39] staging/lustre/clio: wrong cl_lock usage Peng Tao
                   ` (37 subsequent siblings)
  38 siblings, 1 reply; 42+ messages in thread
From: Peng Tao @ 2013-11-14 16:32 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: linux-kernel, John L. Hammond, Peng Tao, Andreas Dilger

From: "John L. Hammond" <john.hammond@intel.com>

Remove the file /proc/fs/lustre/mdc/*/hsm_nl which was introduced "for
testing purposes."

Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-2489
Lustre-change: http://review.whamcloud.com/6656
Signed-off-by: John L. Hammond <john.hammond@intel.com>
Reviewed-by: jacques-Charles Lafoucriere <jacques-charles.lafoucriere@cea.fr>
Reviewed-by: Aurelien Degremont <aurelien.degremont@cea.fr>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: Peng Tao <bergwolf@gmail.com>
Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
---
 drivers/staging/lustre/lustre/mdc/lproc_mdc.c |   73 -------------------------
 1 file changed, 73 deletions(-)

diff --git a/drivers/staging/lustre/lustre/mdc/lproc_mdc.c b/drivers/staging/lustre/lustre/mdc/lproc_mdc.c
index e0b8f18..084f9a6 100644
--- a/drivers/staging/lustre/lustre/mdc/lproc_mdc.c
+++ b/drivers/staging/lustre/lustre/mdc/lproc_mdc.c
@@ -77,78 +77,6 @@ static ssize_t mdc_max_rpcs_in_flight_seq_write(struct file *file,
 }
 LPROC_SEQ_FOPS(mdc_max_rpcs_in_flight);
 
-static int mdc_kuc_open(struct inode *inode, struct file *file)
-{
-	return single_open(file, NULL, PDE_DATA(inode));
-}
-
-/* temporary for testing */
-static ssize_t mdc_kuc_write(struct file *file, const char *buffer,
-			     size_t count, loff_t *off)
-{
-	struct obd_device *obd = ((struct seq_file *)file->private_data)->private;
-	struct kuc_hdr		*lh;
-	struct hsm_action_list	*hal;
-	struct hsm_action_item	*hai;
-	int			 len;
-	int			 fd, rc;
-
-	rc = lprocfs_write_helper(buffer, count, &fd);
-	if (rc)
-		return rc;
-
-	if (fd < 0)
-		return -ERANGE;
-	CWARN("message to fd %d\n", fd);
-
-	len = sizeof(*lh) + sizeof(*hal) + MTI_NAME_MAXLEN +
-		/* for mockup below */ 2 * cfs_size_round(sizeof(*hai));
-
-	OBD_ALLOC(lh, len);
-
-	lh->kuc_magic = KUC_MAGIC;
-	lh->kuc_transport = KUC_TRANSPORT_HSM;
-	lh->kuc_msgtype = HMT_ACTION_LIST;
-	lh->kuc_msglen = len;
-
-	hal = (struct hsm_action_list *)(lh + 1);
-	hal->hal_version = HAL_VERSION;
-	hal->hal_archive_id = 1;
-	hal->hal_flags = 0;
-	obd_uuid2fsname(hal->hal_fsname, obd->obd_name, MTI_NAME_MAXLEN);
-
-	/* mock up an action list */
-	hal->hal_count = 2;
-	hai = hai_zero(hal);
-	hai->hai_action = HSMA_ARCHIVE;
-	hai->hai_fid.f_oid = 5;
-	hai->hai_len = sizeof(*hai);
-	hai = hai_next(hai);
-	hai->hai_action = HSMA_RESTORE;
-	hai->hai_fid.f_oid = 10;
-	hai->hai_len = sizeof(*hai);
-
-	/* This works for either broadcast or unicast to a single fd */
-	if (fd == 0) {
-		rc = libcfs_kkuc_group_put(KUC_GRP_HSM, lh);
-	} else {
-		struct file *fp = fget(fd);
-
-		rc = libcfs_kkuc_msg_put(fp, lh);
-		fput(fp);
-	}
-	OBD_FREE(lh, len);
-	if (rc < 0)
-		return rc;
-	return count;
-}
-
-struct file_operations mdc_kuc_fops = {
-	.open		= mdc_kuc_open,
-	.write		= mdc_kuc_write,
-	.release	= single_release,
-};
-
 LPROC_SEQ_FOPS_WR_ONLY(mdc, ping);
 
 LPROC_SEQ_FOPS_RO_TYPE(mdc, uuid);
@@ -197,7 +125,6 @@ static struct lprocfs_vars lprocfs_mdc_obd_vars[] = {
 	{ "timeouts",		&mdc_timeouts_fops,    0, 0 },
 	{ "import",		&mdc_import_fops, 0 },
 	{ "state",		&mdc_state_fops, 0, 0 },
-	{ "hsm_nl",		&mdc_kuc_fops, 0, 0200 },
 	{ "pinger_recov",	&mdc_pinger_recov_fops, 0, 0 },
 	{ 0 }
 };
-- 
1.7.9.5


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

* [PATCH 02/39] staging/lustre/clio: wrong cl_lock usage
  2013-11-14 16:32 [PATCH 00/39] staging/lustre: patch bomb 2 Peng Tao
  2013-11-14 16:32 ` [PATCH 01/39] staging/lustre/hsm: remove hsm_nl proc file Peng Tao
@ 2013-11-14 16:32 ` Peng Tao
  2013-11-14 16:32 ` [PATCH 03/39] staging/lustre/build: fix 'deadcode' errors Peng Tao
                   ` (36 subsequent siblings)
  38 siblings, 0 replies; 42+ messages in thread
From: Peng Tao @ 2013-11-14 16:32 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-kernel, Vitaly Fertman, Peng Tao, Andreas Dilger

From: Vitaly Fertman <vitaly_fertman@xyratex.com>

granted lock is moved to HELD state in cl_wait_try() only which is
done after upcall for non-agl locks. as the result, lock unuse moves
cl_lock not to CACHED state, but to NEW state. A parallel thread
gets this lock and tries to enqueue it - instead of re-using a
cached lock, cl_enqueue_try() initiates a new enqueue and gets to
osc_lock_enqueue() where it asserts:

LASSERTF(ols->ols_state == OLS_NEW, ...);

the state of osc lock is RELEASED already - moved here by unuse.

Lustre-change: http://review.whamcloud.com/6709
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3433
Signed-off-by: Vitaly Fertman <vitaly_fertman@xyratex.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: Peng Tao <bergwolf@gmail.com>
Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
---
 drivers/staging/lustre/lustre/osc/osc_lock.c |   19 ++++++++++++-------
 1 file changed, 12 insertions(+), 7 deletions(-)

diff --git a/drivers/staging/lustre/lustre/osc/osc_lock.c b/drivers/staging/lustre/lustre/osc/osc_lock.c
index c90abfb..476b2e8 100644
--- a/drivers/staging/lustre/lustre/osc/osc_lock.c
+++ b/drivers/staging/lustre/lustre/osc/osc_lock.c
@@ -554,15 +554,18 @@ static int osc_lock_upcall(void *cookie, int errcode)
 				lock->cll_flags |= CLF_FROM_UPCALL;
 				cl_wait_try(env, lock);
 				lock->cll_flags &= ~CLF_FROM_UPCALL;
-				if (!olck->ols_glimpse)
-					olck->ols_agl = 0;
 			}
 			cl_lock_signal(env, lock);
 			/* del user for lock upcall cookie */
-			cl_unuse_try(env, lock);
+			if (olck->ols_agl) {
+				if (!olck->ols_glimpse)
+					olck->ols_agl = 0;
+				cl_unuse_try(env, lock);
+			}
 		} else {
 			/* del user for lock upcall cookie */
-			cl_lock_user_del(env, lock);
+			if (olck->ols_agl)
+				cl_lock_user_del(env, lock);
 			cl_lock_error(env, lock, rc);
 		}
 
@@ -1128,8 +1131,9 @@ static int osc_lock_enqueue(const struct lu_env *env,
 			/* lock will be passed as upcall cookie,
 			 * hold ref to prevent to be released. */
 			cl_lock_hold_add(env, lock, "upcall", lock);
-			/* a user for lock also */
-			cl_lock_user_add(env, lock);
+			/* a user for agl lock also */
+			if (ols->ols_agl)
+				cl_lock_user_add(env, lock);
 			ols->ols_state = OLS_ENQUEUED;
 
 			/*
@@ -1147,7 +1151,8 @@ static int osc_lock_enqueue(const struct lu_env *env,
 					  ols, einfo, &ols->ols_handle,
 					  PTLRPCD_SET, 1, ols->ols_agl);
 			if (result != 0) {
-				cl_lock_user_del(env, lock);
+				if (ols->ols_agl)
+					cl_lock_user_del(env, lock);
 				cl_lock_unhold(env, lock, "upcall", lock);
 				if (unlikely(result == -ECANCELED)) {
 					ols->ols_state = OLS_NEW;
-- 
1.7.9.5


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

* [PATCH 03/39] staging/lustre/build: fix 'deadcode' errors
  2013-11-14 16:32 [PATCH 00/39] staging/lustre: patch bomb 2 Peng Tao
  2013-11-14 16:32 ` [PATCH 01/39] staging/lustre/hsm: remove hsm_nl proc file Peng Tao
  2013-11-14 16:32 ` [PATCH 02/39] staging/lustre/clio: wrong cl_lock usage Peng Tao
@ 2013-11-14 16:32 ` Peng Tao
  2013-11-14 16:32 ` [PATCH 04/39] staging/lustre/build: fix 'integer handling' issues Peng Tao
                   ` (35 subsequent siblings)
  38 siblings, 0 replies; 42+ messages in thread
From: Peng Tao @ 2013-11-14 16:32 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: linux-kernel, Sebastien Buisson, Peng Tao, Andreas Dilger

From: Sebastien Buisson <sebastien.buisson@bull.net>

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

Lustre-change: http://review.whamcloud.com/7167
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3097
Signed-off-by: Sebastien Buisson <sebastien.buisson@bull.net>
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: Peng Tao <bergwolf@gmail.com>
Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
---
 .../lustre/lustre/libcfs/linux/linux-curproc.c     |    4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/staging/lustre/lustre/libcfs/linux/linux-curproc.c b/drivers/staging/lustre/lustre/libcfs/linux/linux-curproc.c
index a2ef64c..e0f2f79 100644
--- a/drivers/staging/lustre/lustre/libcfs/linux/linux-curproc.c
+++ b/drivers/staging/lustre/lustre/libcfs/linux/linux-curproc.c
@@ -195,7 +195,7 @@ static int cfs_access_process_vm(struct task_struct *tsk, unsigned long addr,
 int cfs_get_environ(const char *key, char *value, int *val_len)
 {
 	struct mm_struct *mm;
-	char *buffer, *tmp_buf = NULL;
+	char *buffer;
 	int buf_len = PAGE_CACHE_SIZE;
 	int key_len = strlen(key);
 	unsigned long addr;
@@ -286,8 +286,6 @@ int cfs_get_environ(const char *key, char *value, int *val_len)
 out:
 	mmput(mm);
 	kfree((void *)buffer);
-	if (tmp_buf)
-		kfree((void *)tmp_buf);
 	return rc;
 }
 EXPORT_SYMBOL(cfs_get_environ);
-- 
1.7.9.5


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

* [PATCH 04/39] staging/lustre/build: fix 'integer handling' issues
  2013-11-14 16:32 [PATCH 00/39] staging/lustre: patch bomb 2 Peng Tao
                   ` (2 preceding siblings ...)
  2013-11-14 16:32 ` [PATCH 03/39] staging/lustre/build: fix 'deadcode' errors Peng Tao
@ 2013-11-14 16:32 ` Peng Tao
  2013-11-14 16:32 ` [PATCH 05/39] staging/lustre/ptlrpc: add rpc_cache Peng Tao
                   ` (34 subsequent siblings)
  38 siblings, 0 replies; 42+ messages in thread
From: Peng Tao @ 2013-11-14 16:32 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: linux-kernel, Sebastien Buisson, Dmitry Eremin, Peng Tao, Andreas Dilger

From: Sebastien Buisson <sebastien.buisson@bull.net>

Fix 'program hangs' defects found by Coverity version 6.5.1:
Improper use of negative value (NEGATIVE_RETURNS)
Variable is passed to a parameter that cannot be negative.
Macro compares unsigned to 0 (NO_EFFECT)
This comparison is always true.
Operands don't affect result (CONSTANT_EXPRESSION_RESULT)
Test is always false regardless of the values of its operands.
Wrong operator used (CONSTANT_EXPRESSION_RESULT)
Test is always true regardless of the values of its operand.

Lustre-change: http://review.whamcloud.com/5888
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3069
Signed-off-by: Sebastien Buisson <sebastien.buisson@bull.net>
Signed-off-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: Peng Tao <bergwolf@gmail.com>
Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
---
 drivers/staging/lustre/lustre/llite/rw.c           |    1 -
 .../staging/lustre/lustre/obdclass/llog_ioctl.c    |    6 ++++--
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/lustre/lustre/llite/rw.c b/drivers/staging/lustre/lustre/llite/rw.c
index e9ba38a..112368f 100644
--- a/drivers/staging/lustre/lustre/llite/rw.c
+++ b/drivers/staging/lustre/lustre/llite/rw.c
@@ -803,7 +803,6 @@ int ll_readahead(const struct lu_env *env, struct cl_io *io,
 	ret = ll_read_ahead_pages(env, io, queue,
 				  ria, &reserved, mapping, &ra_end);
 
-	LASSERTF(reserved >= 0, "reserved %lu\n", reserved);
 	if (reserved != 0)
 		ll_ra_count_put(ll_i2sbi(inode), reserved);
 
diff --git a/drivers/staging/lustre/lustre/obdclass/llog_ioctl.c b/drivers/staging/lustre/lustre/obdclass/llog_ioctl.c
index da558a5..b6ad505 100644
--- a/drivers/staging/lustre/lustre/obdclass/llog_ioctl.c
+++ b/drivers/staging/lustre/lustre/obdclass/llog_ioctl.c
@@ -90,7 +90,8 @@ static int llog_check_cb(const struct lu_env *env, struct llog_handle *handle,
 			 struct llog_rec_hdr *rec, void *data)
 {
 	struct obd_ioctl_data *ioc_data = (struct obd_ioctl_data *)data;
-	static int l, remains, from, to;
+	static int l, remains;
+	static long from, to;
 	static char *out;
 	char *endp;
 	int cur_index, rc = 0;
@@ -174,7 +175,8 @@ static int llog_print_cb(const struct lu_env *env, struct llog_handle *handle,
 			 struct llog_rec_hdr *rec, void *data)
 {
 	struct obd_ioctl_data *ioc_data = (struct obd_ioctl_data *)data;
-	static int l, remains, from, to;
+	static int l, remains;
+	static long from, to;
 	static char *out;
 	char *endp;
 	int cur_index;
-- 
1.7.9.5


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

* [PATCH 05/39] staging/lustre/ptlrpc: add rpc_cache
  2013-11-14 16:32 [PATCH 00/39] staging/lustre: patch bomb 2 Peng Tao
                   ` (3 preceding siblings ...)
  2013-11-14 16:32 ` [PATCH 04/39] staging/lustre/build: fix 'integer handling' issues Peng Tao
@ 2013-11-14 16:32 ` Peng Tao
  2013-11-14 16:32 ` [PATCH 06/39] staging/lustre/lnet: build Lustre with Intel OFED for Xeon Phi Peng Tao
                   ` (33 subsequent siblings)
  38 siblings, 0 replies; 42+ messages in thread
From: Peng Tao @ 2013-11-14 16:32 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: linux-kernel, Andriy Skulysh, Niu Yawei, Peng Tao, Andreas Dilger

From: Andriy Skulysh <Andriy_Skulysh@xyratex.com>

Add rpc_cache for allocating ptlrpc_requests.

Lustre-change: http://review.whamcloud.com/6874
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-2424
Signed-off-by: Andriy Skulysh <Andriy_Skulysh@xyratex.com>
Signed-off-by: Niu Yawei <yawei.niu@intel.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Reviewed-by: Lai Siyao <lai.siyao@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: Peng Tao <bergwolf@gmail.com>
Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
---
 drivers/staging/lustre/lustre/ptlrpc/client.c      |   42 ++++++++++++++++----
 drivers/staging/lustre/lustre/ptlrpc/events.c      |    2 +-
 .../staging/lustre/lustre/ptlrpc/ptlrpc_internal.h |    4 ++
 .../staging/lustre/lustre/ptlrpc/ptlrpc_module.c   |   24 +++++++----
 drivers/staging/lustre/lustre/ptlrpc/sec.c         |    6 +--
 drivers/staging/lustre/lustre/ptlrpc/service.c     |   13 +++---
 6 files changed, 65 insertions(+), 26 deletions(-)

diff --git a/drivers/staging/lustre/lustre/ptlrpc/client.c b/drivers/staging/lustre/lustre/ptlrpc/client.c
index faa982a..9cdee5e 100644
--- a/drivers/staging/lustre/lustre/ptlrpc/client.c
+++ b/drivers/staging/lustre/lustre/ptlrpc/client.c
@@ -378,6 +378,34 @@ static int ptlrpc_at_recv_early_reply(struct ptlrpc_request *req)
 	return rc;
 }
 
+struct kmem_cache *request_cache;
+
+int ptlrpc_request_cache_init()
+{
+	request_cache = kmem_cache_create("ptlrpc_cache",
+					  sizeof(struct ptlrpc_request),
+					  0, SLAB_HWCACHE_ALIGN, NULL);
+	return request_cache == NULL ? -ENOMEM : 0;
+}
+
+void ptlrpc_request_cache_fini()
+{
+	kmem_cache_destroy(request_cache);
+}
+
+struct ptlrpc_request *ptlrpc_request_cache_alloc(int flags)
+{
+	struct ptlrpc_request *req;
+
+	OBD_SLAB_ALLOC_PTR_GFP(req, request_cache, flags);
+	return req;
+}
+
+void ptlrpc_request_cache_free(struct ptlrpc_request *req)
+{
+	OBD_SLAB_FREE_PTR(req, request_cache);
+}
+
 /**
  * Wind down request pool \a pool.
  * Frees all requests from the pool too
@@ -396,7 +424,7 @@ void ptlrpc_free_rq_pool(struct ptlrpc_request_pool *pool)
 		LASSERT(req->rq_reqbuf);
 		LASSERT(req->rq_reqbuf_len == pool->prp_rq_size);
 		OBD_FREE_LARGE(req->rq_reqbuf, pool->prp_rq_size);
-		OBD_FREE(req, sizeof(*req));
+		ptlrpc_request_cache_free(req);
 	}
 	spin_unlock(&pool->prp_lock);
 	OBD_FREE(pool, sizeof(*pool));
@@ -426,12 +454,12 @@ void ptlrpc_add_rqs_to_pool(struct ptlrpc_request_pool *pool, int num_rq)
 		struct lustre_msg *msg;
 
 		spin_unlock(&pool->prp_lock);
-		OBD_ALLOC(req, sizeof(struct ptlrpc_request));
+		req = ptlrpc_request_cache_alloc(__GFP_IO);
 		if (!req)
 			return;
 		OBD_ALLOC_LARGE(msg, size);
 		if (!msg) {
-			OBD_FREE(req, sizeof(struct ptlrpc_request));
+			ptlrpc_request_cache_free(req);
 			return;
 		}
 		req->rq_reqbuf = msg;
@@ -667,7 +695,7 @@ struct ptlrpc_request *__ptlrpc_request_alloc(struct obd_import *imp,
 		request = ptlrpc_prep_req_from_pool(pool);
 
 	if (!request)
-		OBD_ALLOC_PTR(request);
+		request = ptlrpc_request_cache_alloc(__GFP_IO);
 
 	if (request) {
 		LASSERTF((unsigned long)imp > 0x1000, "%p", imp);
@@ -738,7 +766,7 @@ void ptlrpc_request_free(struct ptlrpc_request *request)
 	if (request->rq_pool)
 		__ptlrpc_free_req_to_pool(request);
 	else
-		OBD_FREE_PTR(request);
+		ptlrpc_request_cache_free(request);
 }
 EXPORT_SYMBOL(ptlrpc_request_free);
 
@@ -2216,7 +2244,7 @@ static void __ptlrpc_free_req(struct ptlrpc_request *request, int locked)
 	if (request->rq_pool)
 		__ptlrpc_free_req_to_pool(request);
 	else
-		OBD_FREE(request, sizeof(*request));
+		ptlrpc_request_cache_free(request);
 }
 
 static int __ptlrpc_req_finished(struct ptlrpc_request *request, int locked);
@@ -2934,7 +2962,7 @@ void *ptlrpcd_alloc_work(struct obd_import *imp,
 		return ERR_PTR(-EINVAL);
 
 	/* copy some code from deprecated fakereq. */
-	OBD_ALLOC_PTR(req);
+	req = ptlrpc_request_cache_alloc(__GFP_IO);
 	if (req == NULL) {
 		CERROR("ptlrpc: run out of memory!\n");
 		return ERR_PTR(-ENOMEM);
diff --git a/drivers/staging/lustre/lustre/ptlrpc/events.c b/drivers/staging/lustre/lustre/ptlrpc/events.c
index 58d089c..f5e0d31 100644
--- a/drivers/staging/lustre/lustre/ptlrpc/events.c
+++ b/drivers/staging/lustre/lustre/ptlrpc/events.c
@@ -307,7 +307,7 @@ void request_in_callback(lnet_event_t *ev)
 			/* We moaned above already... */
 			return;
 		}
-		OBD_ALLOC_GFP(req, sizeof(*req), ALLOC_ATOMIC_TRY);
+		req = ptlrpc_request_cache_alloc(ALLOC_ATOMIC_TRY);
 		if (req == NULL) {
 			CERROR("Can't allocate incoming request descriptor: "
 			       "Dropping %s RPC from %s\n",
diff --git a/drivers/staging/lustre/lustre/ptlrpc/ptlrpc_internal.h b/drivers/staging/lustre/lustre/ptlrpc/ptlrpc_internal.h
index ab36347..fa54c5a 100644
--- a/drivers/staging/lustre/lustre/ptlrpc/ptlrpc_internal.h
+++ b/drivers/staging/lustre/lustre/ptlrpc/ptlrpc_internal.h
@@ -55,6 +55,10 @@ int ptlrpcd_start(int index, int max, const char *name, struct ptlrpcd_ctl *pc);
 /* client.c */
 struct ptlrpc_bulk_desc *ptlrpc_new_bulk(unsigned npages, unsigned max_brw,
 					 unsigned type, unsigned portal);
+int ptlrpc_request_cache_init(void);
+void ptlrpc_request_cache_fini(void);
+struct ptlrpc_request *ptlrpc_request_cache_alloc(int flags);
+void ptlrpc_request_cache_free(struct ptlrpc_request *req);
 void ptlrpc_init_xid(void);
 
 /* events.c */
diff --git a/drivers/staging/lustre/lustre/ptlrpc/ptlrpc_module.c b/drivers/staging/lustre/lustre/ptlrpc/ptlrpc_module.c
index 419e634..938aaed 100644
--- a/drivers/staging/lustre/lustre/ptlrpc/ptlrpc_module.c
+++ b/drivers/staging/lustre/lustre/ptlrpc/ptlrpc_module.c
@@ -73,29 +73,34 @@ __init int ptlrpc_init(void)
 		return rc;
 
 	cleanup_phase = 1;
+	rc = ptlrpc_request_cache_init();
+	if (rc)
+		GOTO(cleanup, rc);
 
+	cleanup_phase = 2;
 	rc = ptlrpc_init_portals();
 	if (rc)
 		GOTO(cleanup, rc);
-	cleanup_phase = 2;
+
+	cleanup_phase = 3;
 
 	rc = ptlrpc_connection_init();
 	if (rc)
 		GOTO(cleanup, rc);
-	cleanup_phase = 3;
 
+	cleanup_phase = 4;
 	ptlrpc_put_connection_superhack = ptlrpc_connection_put;
 
 	rc = ptlrpc_start_pinger();
 	if (rc)
 		GOTO(cleanup, rc);
-	cleanup_phase = 4;
 
+	cleanup_phase = 5;
 	rc = ldlm_init();
 	if (rc)
 		GOTO(cleanup, rc);
-	cleanup_phase = 5;
 
+	cleanup_phase = 6;
 	rc = sptlrpc_init();
 	if (rc)
 		GOTO(cleanup, rc);
@@ -117,14 +122,16 @@ cleanup:
 		ptlrpc_nrs_fini();
 	case 7:
 		sptlrpc_fini();
-	case 5:
+	case 6:
 		ldlm_exit();
-	case 4:
+	case 5:
 		ptlrpc_stop_pinger();
-	case 3:
+	case 4:
 		ptlrpc_connection_fini();
-	case 2:
+	case 3:
 		ptlrpc_exit_portals();
+	case 2:
+		ptlrpc_request_cache_fini();
 	case 1:
 		ptlrpc_hr_fini();
 		req_layout_fini();
@@ -142,6 +149,7 @@ static void __exit ptlrpc_exit(void)
 	ldlm_exit();
 	ptlrpc_stop_pinger();
 	ptlrpc_exit_portals();
+	ptlrpc_request_cache_fini();
 	ptlrpc_hr_fini();
 	ptlrpc_connection_fini();
 }
diff --git a/drivers/staging/lustre/lustre/ptlrpc/sec.c b/drivers/staging/lustre/lustre/ptlrpc/sec.c
index 962b31d..7a10f73 100644
--- a/drivers/staging/lustre/lustre/ptlrpc/sec.c
+++ b/drivers/staging/lustre/lustre/ptlrpc/sec.c
@@ -904,7 +904,7 @@ int sptlrpc_import_check_ctx(struct obd_import *imp)
 		return -EACCES;
 	}
 
-	OBD_ALLOC_PTR(req);
+	req = ptlrpc_request_cache_alloc(__GFP_IO);
 	if (!req)
 		return -ENOMEM;
 
@@ -920,7 +920,7 @@ int sptlrpc_import_check_ctx(struct obd_import *imp)
 	rc = sptlrpc_req_refresh_ctx(req, 0);
 	LASSERT(list_empty(&req->rq_ctx_chain));
 	sptlrpc_cli_ctx_put(req->rq_cli_ctx, 1);
-	OBD_FREE_PTR(req);
+	ptlrpc_request_cache_free(req);
 
 	return rc;
 }
@@ -1177,7 +1177,7 @@ void sptlrpc_cli_finish_early_reply(struct ptlrpc_request *early_req)
 
 	sptlrpc_cli_ctx_put(early_req->rq_cli_ctx, 1);
 	OBD_FREE_LARGE(early_req->rq_repbuf, early_req->rq_repbuf_len);
-	OBD_FREE_PTR(early_req);
+	ptlrpc_request_cache_free(early_req);
 }
 
 /**************************************************
diff --git a/drivers/staging/lustre/lustre/ptlrpc/service.c b/drivers/staging/lustre/lustre/ptlrpc/service.c
index 21de868..abd0b8d 100644
--- a/drivers/staging/lustre/lustre/ptlrpc/service.c
+++ b/drivers/staging/lustre/lustre/ptlrpc/service.c
@@ -842,7 +842,7 @@ static void ptlrpc_server_free_request(struct ptlrpc_request *req)
 		/* NB request buffers use an embedded
 		 * req if the incoming req unlinked the
 		 * MD; this isn't one of them! */
-		OBD_FREE(req, sizeof(*req));
+		ptlrpc_request_cache_free(req);
 	}
 }
 
@@ -1306,14 +1306,12 @@ static int ptlrpc_at_send_early_reply(struct ptlrpc_request *req)
 	}
 	newdl = cfs_time_current_sec() + at_get(&svcpt->scp_at_estimate);
 
-	OBD_ALLOC(reqcopy, sizeof(*reqcopy));
+	reqcopy = ptlrpc_request_cache_alloc(__GFP_IO);
 	if (reqcopy == NULL)
 		return -ENOMEM;
 	OBD_ALLOC_LARGE(reqmsg, req->rq_reqlen);
-	if (!reqmsg) {
-		OBD_FREE(reqcopy, sizeof(*reqcopy));
-		return -ENOMEM;
-	}
+	if (!reqmsg)
+		GOTO(out_free, rc = -ENOMEM);
 
 	*reqcopy = *req;
 	reqcopy->rq_reply_state = NULL;
@@ -1370,7 +1368,8 @@ out_put:
 out:
 	sptlrpc_svc_ctx_decref(reqcopy);
 	OBD_FREE_LARGE(reqmsg, req->rq_reqlen);
-	OBD_FREE(reqcopy, sizeof(*reqcopy));
+out_free:
+	ptlrpc_request_cache_free(reqcopy);
 	return rc;
 }
 
-- 
1.7.9.5


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

* [PATCH 06/39] staging/lustre/lnet: build Lustre with Intel OFED for Xeon Phi
  2013-11-14 16:32 [PATCH 00/39] staging/lustre: patch bomb 2 Peng Tao
                   ` (4 preceding siblings ...)
  2013-11-14 16:32 ` [PATCH 05/39] staging/lustre/ptlrpc: add rpc_cache Peng Tao
@ 2013-11-14 16:32 ` Peng Tao
  2013-11-14 16:32 ` [PATCH 07/39] staging/lustre/osd-ldiskfs: remove dependency on mdd module Peng Tao
                   ` (32 subsequent siblings)
  38 siblings, 0 replies; 42+ messages in thread
From: Peng Tao @ 2013-11-14 16:32 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-kernel, Dmitry Eremin, Peng Tao, Andreas Dilger

From: Dmitry Eremin <dmitry.eremin@intel.com>

The compilation of Lustre with Intel OFED for Xeon Phi failed
because of missing include of pci-dma.h header file. In Linux
kernel includes this file included automatically from pci.h
but in Intel Xeon Phi headers it's not true. So, just add this
include explicitly.

Lustre-change: http://review.whamcloud.com/7115
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3637
Signed-off-by: Dmitry Eremin <dmitry.eremin@intel.com>
Reviewed-by: Liang Zhen <liang.zhen@intel.com>
Reviewed-by: Doug Oucharek <doug.s.oucharek@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: Peng Tao <bergwolf@gmail.com>
Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
---
 .../staging/lustre/lnet/klnds/o2iblnd/o2iblnd.h    |    2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.h b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.h
index 938df0c..8cfd78b 100644
--- a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.h
+++ b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.h
@@ -38,6 +38,7 @@
  * Author: Eric Barton <eric@bartonsoftware.com>
  */
 
+#include <linux/version.h>
 #include <linux/module.h>
 #include <linux/kernel.h>
 #include <linux/mm.h>
@@ -57,6 +58,7 @@
 #include <linux/kmod.h>
 #include <linux/sysctl.h>
 #include <linux/pci.h>
+#include <linux/pci-dma.h>
 
 #include <net/sock.h>
 #include <linux/in.h>
-- 
1.7.9.5


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

* [PATCH 07/39] staging/lustre/osd-ldiskfs: remove dependency on mdd module
  2013-11-14 16:32 [PATCH 00/39] staging/lustre: patch bomb 2 Peng Tao
                   ` (5 preceding siblings ...)
  2013-11-14 16:32 ` [PATCH 06/39] staging/lustre/lnet: build Lustre with Intel OFED for Xeon Phi Peng Tao
@ 2013-11-14 16:32 ` Peng Tao
  2013-11-14 16:32 ` [PATCH 08/39] staging/lustre/libcfs: improve validity test for valid file descriptors Peng Tao
                   ` (31 subsequent siblings)
  38 siblings, 0 replies; 42+ messages in thread
From: Peng Tao @ 2013-11-14 16:32 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-kernel, Andreas Dilger, Dmitry Eremin, Peng Tao

From: Andreas Dilger <andreas.dilger@intel.com>

Move the lu_capainfo_get() function (formerly named md_capainfo())
into obdclass/capa.c instead of mdd_device.c.  Otherwise, the
osd-ldiskfs.ko module depends on mdd.ko in order to load, and that
doesn't really make sense.

Move the lu_capainfo structure (formerly named md_capainfo) into
lustre_capa.h, and change the structure field prefix to match the
new name.  Fix up the users of this structure/function, and do some
code style cleanup in those functions at the same time.

Move the mdt_set_capainfo() and mdt_dump_capainfo() structures from
being static inline in mdt_internal.h into mdt_lib.c, since they are
too big to be static inline functions.  mdt_dump_capainfo() isn't
used anywhere, so it is put under #ifdef DEBUG_CAPA.  They should
really be named mdt_capainfo_{set,dump}(), but that was too big a
change for this patch.

Lustre-change: http://review.whamcloud.com/6945
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3556
Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
Signed-off-by: Dmitry Eremin <dmitry.eremin@intel.com>
Reviewed-by: Alex Zhuravlev <alexey.zhuravlev@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: Peng Tao <bergwolf@gmail.com>
Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
---
 .../staging/lustre/lustre/include/lustre_capa.h    |   25 ++++++++++--
 drivers/staging/lustre/lustre/include/md_object.h  |   20 ----------
 drivers/staging/lustre/lustre/obdclass/capa.c      |   41 ++++++++++++++++++++
 drivers/staging/lustre/lustre/obdclass/class_obd.c |    5 +++
 4 files changed, 67 insertions(+), 24 deletions(-)

diff --git a/drivers/staging/lustre/lustre/include/lustre_capa.h b/drivers/staging/lustre/lustre/include/lustre_capa.h
index d77bffc..3d608ed 100644
--- a/drivers/staging/lustre/lustre/include/lustre_capa.h
+++ b/drivers/staging/lustre/lustre/include/lustre_capa.h
@@ -292,14 +292,31 @@ struct filter_capa_key {
 	struct lustre_capa_key  k_key;
 };
 
-enum {
-	LC_ID_NONE      = 0,
-	LC_ID_PLAIN     = 1,
-	LC_ID_CONVERT   = 2
+enum lc_auth_id {
+	LC_ID_NONE	= 0,
+	LC_ID_PLAIN	= 1,
+	LC_ID_CONVERT	= 2
 };
 
 #define BYPASS_CAPA (struct lustre_capa *)ERR_PTR(-ENOENT)
 
+enum {
+	LU_CAPAINFO_MAX = 5
+};
+
+/** there are at most 5 FIDs in one operation, see rename,
+ *  NOTE the last one is a temporary one used for is_subdir() */
+struct lu_capainfo {
+	enum lc_auth_id		 lci_auth;
+	__u32			 lci_padding;
+	struct lu_fid		 lci_fid[LU_CAPAINFO_MAX];
+	struct lustre_capa	*lci_capa[LU_CAPAINFO_MAX];
+};
+
+int  lu_capainfo_init(void);
+void lu_capainfo_fini(void);
+struct lu_capainfo *lu_capainfo_get(const struct lu_env *env);
+
 /** @} capa */
 
 #endif /* __LINUX_CAPA_H_ */
diff --git a/drivers/staging/lustre/lustre/include/md_object.h b/drivers/staging/lustre/lustre/include/md_object.h
index 7b45b47..a25a5a3 100644
--- a/drivers/staging/lustre/lustre/include/md_object.h
+++ b/drivers/staging/lustre/lustre/include/md_object.h
@@ -70,30 +70,10 @@ enum {
 	UCRED_NEW       = 2
 };
 
-enum {
-	MD_CAPAINFO_MAX = 5
-};
-
-/** there are at most 5 fids in one operation, see rename, NOTE the last one
- * is a temporary one used for is_subdir() */
-struct md_capainfo {
-	__u32		   mc_auth;
-	__u32		   mc_padding;
-	struct lu_fid	   mc_fid[MD_CAPAINFO_MAX];
-	struct lustre_capa     *mc_capa[MD_CAPAINFO_MAX];
-};
-
 struct md_quota {
 	struct obd_export       *mq_exp;
 };
 
-/**
- * Implemented in mdd/mdd_handler.c.
- *
- * XXX should be moved into separate .h/.c together with all md security
- * related definitions.
- */
-struct md_capainfo *md_capainfo(const struct lu_env *env);
 struct md_quota *md_quota(const struct lu_env *env);
 
 /** metadata attributes */
diff --git a/drivers/staging/lustre/lustre/obdclass/capa.c b/drivers/staging/lustre/lustre/obdclass/capa.c
index 68d797b..63981d0 100644
--- a/drivers/staging/lustre/lustre/obdclass/capa.c
+++ b/drivers/staging/lustre/lustre/obdclass/capa.c
@@ -416,3 +416,44 @@ void _debug_capa(struct lustre_capa *c,
 	va_end(args);
 }
 EXPORT_SYMBOL(_debug_capa);
+
+/*
+ * context key constructor/destructor:
+ * lu_capainfo_key_init, lu_capainfo_key_fini
+ */
+LU_KEY_INIT_FINI(lu_capainfo, struct lu_capainfo);
+
+struct lu_context_key lu_capainfo_key = {
+	.lct_tags = LCT_SESSION,
+	.lct_init = lu_capainfo_key_init,
+	.lct_fini = lu_capainfo_key_fini
+};
+
+struct lu_capainfo *lu_capainfo_get(const struct lu_env *env)
+{
+	/* NB, in mdt_init0 */
+	if (env->le_ses == NULL)
+		return NULL;
+	return lu_context_key_get(env->le_ses, &lu_capainfo_key);
+}
+EXPORT_SYMBOL(lu_capainfo_get);
+
+/**
+ * Initialization of lu_capainfo_key data.
+ */
+int lu_capainfo_init(void)
+{
+	int rc;
+
+	LU_CONTEXT_KEY_INIT(&lu_capainfo_key);
+	rc = lu_context_key_register(&lu_capainfo_key);
+	return rc;
+}
+
+/**
+ * Dual to lu_capainfo_init().
+ */
+void lu_capainfo_fini(void)
+{
+	lu_context_key_degister(&lu_capainfo_key);
+}
diff --git a/drivers/staging/lustre/lustre/obdclass/class_obd.c b/drivers/staging/lustre/lustre/obdclass/class_obd.c
index 4afd962..8d2c6a8 100644
--- a/drivers/staging/lustre/lustre/obdclass/class_obd.c
+++ b/drivers/staging/lustre/lustre/obdclass/class_obd.c
@@ -572,6 +572,10 @@ static int __init init_obdclass(void)
 	if (err)
 		return err;
 
+	err = lu_capainfo_init();
+	if (err)
+		return err;
+
 	err = cl_global_init();
 	if (err != 0)
 		return err;
@@ -651,6 +655,7 @@ static void cleanup_obdclass(void)
 	}
 	llog_info_fini();
 	cl_global_fini();
+	lu_capainfo_fini();
 	lu_global_fini();
 
 	obd_cleanup_caches();
-- 
1.7.9.5


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

* [PATCH 08/39] staging/lustre/libcfs: improve validity test for valid file descriptors
  2013-11-14 16:32 [PATCH 00/39] staging/lustre: patch bomb 2 Peng Tao
                   ` (6 preceding siblings ...)
  2013-11-14 16:32 ` [PATCH 07/39] staging/lustre/osd-ldiskfs: remove dependency on mdd module Peng Tao
@ 2013-11-14 16:32 ` Peng Tao
  2013-11-14 16:32 ` [PATCH 09/39] staging/lustre/llite: use 64bits flags in ll_lov_setea() Peng Tao
                   ` (30 subsequent siblings)
  38 siblings, 0 replies; 42+ messages in thread
From: Peng Tao @ 2013-11-14 16:32 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-kernel, Bob Glossman, Peng Tao, Andreas Dilger

From: Bob Glossman <bob.glossman@intel.com>

File descriptor members of struct lustre_kernelcomm aren't set to
anything special at start time.
This leads to incorrect tests and skipping valid fd closes at stop time.
Fixed by defining, setting, and testing against a specific LK_NOFD value.

Lustre-change: http://review.whamcloud.com/7275
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3683
Signed-off-by: Bob Glossman <bob.glossman@intel.com>
Reviewed-by: John L. Hammond <john.hammond@intel.com>
Reviewed-by: Keith Mannthey <keith.mannthey@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: Peng Tao <bergwolf@gmail.com>
Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
---
 .../include/linux/libcfs/libcfs_kernelcomm.h       |    1 +
 .../lustre/lustre/libcfs/kernel_user_comm.c        |   10 ++++++++--
 2 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/lustre/include/linux/libcfs/libcfs_kernelcomm.h b/drivers/staging/lustre/include/linux/libcfs/libcfs_kernelcomm.h
index 596a15f..4e12ffc 100644
--- a/drivers/staging/lustre/include/linux/libcfs/libcfs_kernelcomm.h
+++ b/drivers/staging/lustre/include/linux/libcfs/libcfs_kernelcomm.h
@@ -97,6 +97,7 @@ extern int libcfs_kkuc_group_foreach(int group, libcfs_kkuc_cb_t cb_func,
 				     void *cb_arg);
 
 #define LK_FLG_STOP 0x01
+#define LK_NOFD -1U
 
 /* kernelcomm control structure, passed from userspace to kernel */
 typedef struct lustre_kernelcomm {
diff --git a/drivers/staging/lustre/lustre/libcfs/kernel_user_comm.c b/drivers/staging/lustre/lustre/libcfs/kernel_user_comm.c
index 74a0db5..9e5e3cc 100644
--- a/drivers/staging/lustre/lustre/libcfs/kernel_user_comm.c
+++ b/drivers/staging/lustre/lustre/libcfs/kernel_user_comm.c
@@ -56,6 +56,8 @@ int libcfs_ukuc_start(lustre_kernelcomm *link, int group)
 {
 	int pfd[2];
 
+	link->lk_rfd = link->lk_wfd = LK_NOFD;
+
 	if (pipe(pfd) < 0)
 		return -errno;
 
@@ -69,9 +71,13 @@ int libcfs_ukuc_start(lustre_kernelcomm *link, int group)
 
 int libcfs_ukuc_stop(lustre_kernelcomm *link)
 {
-	if (link->lk_wfd > 0)
+	int rc;
+
+	if (link->lk_wfd != LK_NOFD)
 		close(link->lk_wfd);
-	return close(link->lk_rfd);
+	rc = close(link->lk_rfd);
+	link->lk_rfd = link->lk_wfd = LK_NOFD;
+	return rc;
 }
 
 #define lhsz sizeof(*kuch)
-- 
1.7.9.5


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

* [PATCH 09/39] staging/lustre/llite: use 64bits flags in ll_lov_setea()
  2013-11-14 16:32 [PATCH 00/39] staging/lustre: patch bomb 2 Peng Tao
                   ` (7 preceding siblings ...)
  2013-11-14 16:32 ` [PATCH 08/39] staging/lustre/libcfs: improve validity test for valid file descriptors Peng Tao
@ 2013-11-14 16:32 ` Peng Tao
  2013-11-14 16:32 ` [PATCH 10/39] staging/lustre/hsm: small fixes for HSM Peng Tao
                   ` (29 subsequent siblings)
  38 siblings, 0 replies; 42+ messages in thread
From: Peng Tao @ 2013-11-14 16:32 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-kernel, Niu Yawei, Peng Tao, Andreas Dilger

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.

Lustre-change: http://review.whamcloud.com/7312
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3744
Signed-off-by: Niu Yawei <yawei.niu@intel.com>
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: Peng Tao <bergwolf@gmail.com>
Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
---
 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 02b297b..d3f375d 100644
--- a/drivers/staging/lustre/lustre/llite/file.c
+++ b/drivers/staging/lustre/lustre/llite/file.c
@@ -1401,7 +1401,8 @@ static int ll_lov_recreate_fid(struct inode *inode, unsigned long arg)
 }
 
 int ll_lov_setstripe_ea_info(struct inode *inode, struct file *file,
-			     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};
@@ -1522,7 +1523,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);
@@ -1554,7 +1555,7 @@ static int ll_lov_setstripe(struct inode *inode, struct file *file,
 	struct lov_user_md_v1	*lumv1p = (struct lov_user_md_v1 *)arg;
 	struct lov_user_md_v3	*lumv3p = (struct lov_user_md_v3 *)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 37e33ab..69b5d91 100644
--- a/drivers/staging/lustre/lustre/llite/llite_internal.h
+++ b/drivers/staging/lustre/lustre/llite/llite_internal.h
@@ -790,7 +790,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 file *file,
-			     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 8c96854..b6cb0db 100644
--- a/drivers/staging/lustre/lustre/llite/xattr.c
+++ b/drivers/staging/lustre/lustre/llite/xattr.c
@@ -236,13 +236,13 @@ int ll_setxattr(struct dentry *dentry, const char *name,
 			lump->lmm_stripe_offset = -1;
 
 		if (lump != NULL && S_ISREG(inode->i_mode)) {
-			struct file f;
-			int flags = FMODE_WRITE;
+			struct file	f;
+			__u64		it_flags = FMODE_WRITE;
 			int lum_size = (lump->lmm_magic == LOV_USER_MAGIC_V1) ?
 				sizeof(*lump) : sizeof(struct lov_user_md_v3);
 
 			f.f_dentry = dentry;
-			rc = ll_lov_setstripe_ea_info(inode, &f, flags, lump,
+			rc = ll_lov_setstripe_ea_info(inode, &f, it_flags, lump,
 						      lum_size);
 			/* b10667: rc always be 0 here for now */
 			rc = 0;
-- 
1.7.9.5


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

* [PATCH 10/39] staging/lustre/hsm: small fixes for HSM
  2013-11-14 16:32 [PATCH 00/39] staging/lustre: patch bomb 2 Peng Tao
                   ` (8 preceding siblings ...)
  2013-11-14 16:32 ` [PATCH 09/39] staging/lustre/llite: use 64bits flags in ll_lov_setea() Peng Tao
@ 2013-11-14 16:32 ` Peng Tao
  2013-11-14 16:32 ` [PATCH 11/39] staging/lustre/mdt: CDT cleanup follow-on patch Peng Tao
                   ` (28 subsequent siblings)
  38 siblings, 0 replies; 42+ messages in thread
From: Peng Tao @ 2013-11-14 16:32 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-kernel, Jinshan Xiong, Peng Tao, Andreas Dilger

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

This patch includes the following fixes for HSM:
1. Redefine D_HSM. It was defined to D_TRACE;
2. Fix lu_ref for lease handle
3. User input verification to make sure the hur size is less than
MDS_MAXREQSIZE;

Lustre-change: http://review.whamcloud.com/7243
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3647
Signed-off-by: Jinshan Xiong <jinshan.xiong@intel.com>
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: Peng Tao <bergwolf@gmail.com>
Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
---
 .../lustre/include/linux/libcfs/libcfs_debug.h     |  129 ++++++++++---------
 drivers/staging/lustre/lustre/libcfs/debug.c       |  131 ++------------------
 drivers/staging/lustre/lustre/llite/dir.c          |    5 +
 drivers/staging/lustre/lustre/llite/file.c         |    4 +-
 drivers/staging/lustre/lustre/mdc/mdc_lib.c        |    2 +-
 5 files changed, 89 insertions(+), 182 deletions(-)

diff --git a/drivers/staging/lustre/include/linux/libcfs/libcfs_debug.h b/drivers/staging/lustre/include/linux/libcfs/libcfs_debug.h
index 40282b7..02a77de 100644
--- a/drivers/staging/lustre/include/linux/libcfs/libcfs_debug.h
+++ b/drivers/staging/lustre/include/linux/libcfs/libcfs_debug.h
@@ -87,74 +87,83 @@ struct ptldebug_header {
 
 /* 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
-#define S_OSC	 0x00000008
-#define S_OST	 0x00000010
-#define S_CLASS       0x00000020
-#define S_LOG	 0x00000040
-#define S_LLITE       0x00000080
-#define S_RPC	 0x00000100
-#define S_MGMT	0x00000200
-#define S_LNET	0x00000400
-#define S_LND	 0x00000800 /* ALL LNDs */
-#define S_PINGER      0x00001000
-#define S_FILTER      0x00002000
+#define S_UNDEFINED	0x00000001
+#define S_MDC		0x00000002
+#define S_MDS		0x00000004
+#define S_OSC		0x00000008
+#define S_OST		0x00000010
+#define S_CLASS		0x00000020
+#define S_LOG		0x00000040
+#define S_LLITE		0x00000080
+#define S_RPC		0x00000100
+#define S_MGMT		0x00000200
+#define S_LNET		0x00000400
+#define S_LND		0x00000800 /* ALL LNDs */
+#define S_PINGER	0x00001000
+#define S_FILTER	0x00002000
 /* unused */
-#define S_ECHO	0x00008000
-#define S_LDLM	0x00010000
-#define S_LOV	 0x00020000
-#define S_LQUOTA      0x00040000
+#define S_ECHO		0x00008000
+#define S_LDLM		0x00010000
+#define S_LOV		0x00020000
+#define S_LQUOTA	0x00040000
 #define S_OSD		0x00080000
+#define S_LFSCK		0x00100000
 /* unused */
 /* unused */
+#define S_LMV		0x00800000 /* b_new_cmd */
 /* unused */
-#define S_LMV	 0x00800000 /* b_new_cmd */
+#define S_SEC		0x02000000 /* upcall cache */
+#define S_GSS		0x04000000 /* b_new_cmd */
 /* unused */
-#define S_SEC	 0x02000000 /* upcall cache */
-#define S_GSS	 0x04000000 /* b_new_cmd */
-/* unused */
-#define S_MGC	 0x10000000
-#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 */
+#define S_MGC		0x10000000
+#define S_MGS		0x20000000
+#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) */
-/* 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
-#define D_EXT2	0x00000008 /* anything from ext2_debug */
-#define D_MALLOC      0x00000010 /* print malloc, free information */
-#define D_CACHE       0x00000020 /* cache-related items */
-#define D_INFO	0x00000040 /* general information */
-#define D_IOCTL       0x00000080 /* ioctl related information */
-#define D_NETERROR    0x00000100 /* network errors */
-#define D_NET	 0x00000200 /* network communications */
-#define D_WARNING     0x00000400 /* CWARN(...) == CDEBUG (D_WARNING, ...) */
-#define D_BUFFS       0x00000800
-#define D_OTHER       0x00001000
-#define D_DENTRY      0x00002000
-#define D_NETTRACE    0x00004000
-#define D_PAGE	0x00008000 /* bulk page handling */
-#define D_DLMTRACE    0x00010000
-#define D_ERROR       0x00020000 /* CERROR(...) == CDEBUG (D_ERROR, ...) */
-#define D_EMERG       0x00040000 /* CEMERG(...) == CDEBUG (D_EMERG, ...) */
-#define D_HA	  0x00080000 /* recovery and failover */
-#define D_RPCTRACE    0x00100000 /* for distributed debugging */
-#define D_VFSTRACE    0x00200000
-#define D_READA       0x00400000 /* read-ahead */
-#define D_MMAP	0x00800000
-#define D_CONFIG      0x01000000
-#define D_CONSOLE     0x02000000
-#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
+#define D_TRACE		0x00000001 /* ENTRY/EXIT markers */
+#define D_INODE		0x00000002
+#define D_SUPER		0x00000004
+#define D_EXT2		0x00000008 /* anything from ext2_debug */
+#define D_MALLOC	0x00000010 /* print malloc, free information */
+#define D_CACHE		0x00000020 /* cache-related items */
+#define D_INFO		0x00000040 /* general information */
+#define D_IOCTL		0x00000080 /* ioctl related information */
+#define D_NETERROR	0x00000100 /* network errors */
+#define D_NET		0x00000200 /* network communications */
+#define D_WARNING	0x00000400 /* CWARN(...) == CDEBUG (D_WARNING, ...) */
+#define D_BUFFS		0x00000800
+#define D_OTHER		0x00001000
+#define D_DENTRY	0x00002000
+#define D_NETTRACE	0x00004000
+#define D_PAGE		0x00008000 /* bulk page handling */
+#define D_DLMTRACE	0x00010000
+#define D_ERROR		0x00020000 /* CERROR(...) == CDEBUG (D_ERROR, ...) */
+#define D_EMERG		0x00040000 /* CEMERG(...) == CDEBUG (D_EMERG, ...) */
+#define D_HA		0x00080000 /* recovery and failover */
+#define D_RPCTRACE	0x00100000 /* for distributed debugging */
+#define D_VFSTRACE	0x00200000
+#define D_READA		0x00400000 /* read-ahead */
+#define D_MMAP		0x00800000
+#define D_CONFIG	0x01000000
+#define D_CONSOLE	0x02000000
+#define D_QUOTA		0x04000000
+#define D_SEC		0x08000000
+#define D_LFSCK		0x10000000 /* For both OI scrub and LFSCK */
+#define D_HSM		0x20000000
+
+#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)
 
diff --git a/drivers/staging/lustre/lustre/libcfs/debug.c b/drivers/staging/lustre/lustre/libcfs/debug.c
index 9b9c451..581fc18 100644
--- a/drivers/staging/lustre/lustre/libcfs/debug.c
+++ b/drivers/staging/lustre/lustre/libcfs/debug.c
@@ -124,132 +124,25 @@ int libcfs_panic_in_progress;
 
 /* libcfs_debug_token2mask() expects the returned
  * string in lower-case */
-const char *
-libcfs_debug_subsys2str(int subsys)
+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_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 */
-const char *
-libcfs_debug_dbg2str(int debug)
+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
diff --git a/drivers/staging/lustre/lustre/llite/dir.c b/drivers/staging/lustre/lustre/llite/dir.c
index 1b217c8..044aa095 100644
--- a/drivers/staging/lustre/lustre/llite/dir.c
+++ b/drivers/staging/lustre/lustre/llite/dir.c
@@ -1804,6 +1804,11 @@ out_rmdir:
 		/* Compute the whole struct size */
 		totalsize = hur_len(hur);
 		OBD_FREE_PTR(hur);
+
+		/* Make sure the size is reasonable */
+		if (totalsize >= MDS_MAXREQSIZE)
+			return -E2BIG;
+
 		OBD_ALLOC_LARGE(hur, totalsize);
 		if (hur == NULL)
 			return -ENOMEM;
diff --git a/drivers/staging/lustre/lustre/llite/file.c b/drivers/staging/lustre/lustre/llite/file.c
index d3f375d..04dc9ce 100644
--- a/drivers/staging/lustre/lustre/llite/file.c
+++ b/drivers/staging/lustre/lustre/llite/file.c
@@ -881,7 +881,7 @@ 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",
@@ -2478,7 +2478,7 @@ long 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 91f6876..a839c96 100644
--- a/drivers/staging/lustre/lustre/mdc/mdc_lib.c
+++ b/drivers/staging/lustre/lustre/mdc/mdc_lib.c
@@ -504,7 +504,7 @@ static void mdc_hsm_release_pack(struct ptlrpc_request *req,
 		lock = ldlm_handle2lock(&op_data->op_lease_handle);
 		if (lock != NULL) {
 			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.9.5


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

* [PATCH 11/39] staging/lustre/mdt: CDT cleanup follow-on patch
  2013-11-14 16:32 [PATCH 00/39] staging/lustre: patch bomb 2 Peng Tao
                   ` (9 preceding siblings ...)
  2013-11-14 16:32 ` [PATCH 10/39] staging/lustre/hsm: small fixes for HSM Peng Tao
@ 2013-11-14 16:32 ` Peng Tao
  2013-11-14 16:32 ` [PATCH 12/39] staging/lustre/utils: Posix copytool fixes Peng Tao
                   ` (27 subsequent siblings)
  38 siblings, 0 replies; 42+ messages in thread
From: Peng Tao @ 2013-11-14 16:32 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-kernel, JC Lafoucriere, Peng Tao, Andreas Dilger

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

This patch implements the comments made during the review after
maloo passed test or after the landing.

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

replace use of cfs_helpers by native one in CDT
 replace atomic_t and helpers
 replace cfs_list and helpers
 change list_for_each + list_entry by list_entry_for_each
 replace cfs_task_t

clean err msg in HSM agent interface
 remove duplicate rc print

parenthesis code cleaning
 remove useless () in conditionnal tests

Lustre-change: http://review.whamcloud.com/7254
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3709
Signed-off-by: JC Lafoucriere <jacques-charles.lafoucriere@cea.fr>
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: Peng Tao <bergwolf@gmail.com>
Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
---
 .../lustre/lustre/include/lustre/lustre_user.h     |    4 ++--
 drivers/staging/lustre/lustre/mdc/mdc_request.c    |    2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/lustre/lustre/include/lustre/lustre_user.h b/drivers/staging/lustre/lustre/include/lustre/lustre_user.h
index c63a1ae..2c72a88 100644
--- a/drivers/staging/lustre/lustre/include/lustre/lustre_user.h
+++ b/drivers/staging/lustre/lustre/include/lustre/lustre_user.h
@@ -1106,7 +1106,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-> \
@@ -1126,7 +1126,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));
-	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 e418b58..eb3b44f 100644
--- a/drivers/staging/lustre/lustre/mdc/mdc_request.c
+++ b/drivers/staging/lustre/lustre/mdc/mdc_request.c
@@ -1957,7 +1957,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.9.5


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

* [PATCH 12/39] staging/lustre/utils: Posix copytool fixes.
  2013-11-14 16:32 [PATCH 00/39] staging/lustre: patch bomb 2 Peng Tao
                   ` (10 preceding siblings ...)
  2013-11-14 16:32 ` [PATCH 11/39] staging/lustre/mdt: CDT cleanup follow-on patch Peng Tao
@ 2013-11-14 16:32 ` Peng Tao
  2013-11-14 16:32 ` [PATCH 13/39] staging/lustre/lmv: update coding style Peng Tao
                   ` (26 subsequent siblings)
  38 siblings, 0 replies; 42+ messages in thread
From: Peng Tao @ 2013-11-14 16:32 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-kernel, Henri Doreau, Peng Tao, Andreas Dilger

From: Henri Doreau <henri.doreau@cea.fr>

Fixed several defects in the HSM posix copytool.
- Fixed two invalid format strings.
- Made --daemon optional.
- Remove .lov entries from the archive when removing the corresponding
  files.
- When restoring a file for which no LOV EA has been saved we must not
  create the volatile with O_LOV_DELAY_CREATE. Additionally, the
  caller should be able to specify the MDT index where to create the
  volatile file. Added parameters to llapi_hsm_action_begin()
  accordingly.

Lustre-change: http://review.whamcloud.com/7237
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3693
Signed-off-by: Henri Doreau <henri.doreau@cea.fr>
Reviewed-by: John L. Hammond <john.hammond@intel.com>
Reviewed-by: Jinshan Xiong <jinshan.xiong@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: Peng Tao <bergwolf@gmail.com>
Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
---
 .../lustre/lustre/include/lustre/lustreapi.h       |    7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/lustre/lustre/include/lustre/lustreapi.h b/drivers/staging/lustre/lustre/include/lustre/lustreapi.h
index 0bb3c9f..e6ce238 100644
--- a/drivers/staging/lustre/lustre/include/lustre/lustreapi.h
+++ b/drivers/staging/lustre/lustre/include/lustre/lustreapi.h
@@ -307,11 +307,12 @@ extern int llapi_hsm_copytool_unregister(struct hsm_copytool_private **priv);
 extern int llapi_hsm_copytool_recv(struct hsm_copytool_private *priv,
 				   struct hsm_action_list **hal, int *msgsize);
 extern void llapi_hsm_action_list_free(struct hsm_action_list **hal);
-extern int llapi_hsm_action_begin(struct hsm_copyaction_private **hcp,
-				  const struct hsm_copytool_private *ct_priv,
+extern int llapi_hsm_action_begin(struct hsm_copyaction_private **phcp,
+				  const struct hsm_copytool_private *ct,
 				  const struct hsm_action_item *hai,
+				  int restore_mdt_index, int restore_open_flags,
 				  bool is_error);
-extern int llapi_hsm_action_end(struct hsm_copyaction_private **hcp,
+extern int llapi_hsm_action_end(struct hsm_copyaction_private **phcp,
 				const struct hsm_extent *he, int flags,
 				int errval);
 extern int llapi_hsm_action_progress(struct hsm_copyaction_private *hcp,
-- 
1.7.9.5


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

* [PATCH 13/39] staging/lustre/lmv: update coding style
  2013-11-14 16:32 [PATCH 00/39] staging/lustre: patch bomb 2 Peng Tao
                   ` (11 preceding siblings ...)
  2013-11-14 16:32 ` [PATCH 12/39] staging/lustre/utils: Posix copytool fixes Peng Tao
@ 2013-11-14 16:32 ` Peng Tao
  2013-11-14 16:32 ` [PATCH 14/39] staging/lustre/hsm: copy start error should set HP_FLAG_COMPLETED Peng Tao
                   ` (25 subsequent siblings)
  38 siblings, 0 replies; 42+ messages in thread
From: Peng Tao @ 2013-11-14 16:32 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-kernel, JC Lafoucriere, Peng Tao, Andreas Dilger

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

in lmv_obd.c:
- Correct wrong coding styles introduced by HSM (and others)
- Remove useless include

Lustre-change: http://review.whamcloud.com/7252
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3709
Signed-off-by: JC Lafoucriere <jacques-charles.lafoucriere@cea.fr>
Reviewed-by: John L. Hammond <john.hammond@intel.com>
Reviewed-by: Jinshan Xiong <jinshan.xiong@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: Peng Tao <bergwolf@gmail.com>
Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
---
 drivers/staging/lustre/lustre/lmv/lmv_obd.c |   42 +++++++++++++--------------
 1 file changed, 21 insertions(+), 21 deletions(-)

diff --git a/drivers/staging/lustre/lustre/lmv/lmv_obd.c b/drivers/staging/lustre/lustre/lmv/lmv_obd.c
index c286604..9d36014 100644
--- a/drivers/staging/lustre/lustre/lmv/lmv_obd.c
+++ b/drivers/staging/lustre/lustre/lmv/lmv_obd.c
@@ -43,7 +43,6 @@
 #include <asm/div64.h>
 #include <linux/seq_file.h>
 #include <linux/namei.h>
-#include <asm/uaccess.h>
 
 #include <lustre/lustre_idl.h>
 #include <obd_support.h>
@@ -802,10 +801,10 @@ static void lmv_hsm_req_build(struct lmv_obd *lmv,
 	nr_out = 0;
 	for (i = 0; i < hur_in->hur_request.hr_itemcount; i++) {
 		curr_tgt = lmv_find_target(lmv,
-					&hur_in->hur_user_item[i].hui_fid);
+					   &hur_in->hur_user_item[i].hui_fid);
 		if (obd_uuid_equals(&curr_tgt->ltd_uuid, &tgt_mds->ltd_uuid)) {
 			hur_out->hur_user_item[nr_out] =
-				hur_in->hur_user_item[i];
+						hur_in->hur_user_item[i];
 			nr_out++;
 		}
 	}
@@ -851,17 +850,18 @@ static int lmv_hsm_ct_register(struct lmv_obd *lmv, unsigned int cmd, int len,
 		if (err) {
 			if (lmv->tgts[i]->ltd_active) {
 				/* permanent error */
-				CERROR("error: iocontrol MDC %s on MDT"
-				       "idx %d cmd %x: err = %d\n",
-					lmv->tgts[i]->ltd_uuid.uuid,
-					i, cmd, err);
+				CERROR("%s: iocontrol MDC %s on MDT"
+				       " idx %d cmd %x: err = %d\n",
+				       class_exp2obd(lmv->exp)->obd_name,
+				       lmv->tgts[i]->ltd_uuid.uuid,
+				       i, cmd, err);
 				rc = err;
 				lk->lk_flags |= LK_FLG_STOP;
 				/* unregister from previous MDS */
 				for (j = 0; j < i; j++)
 					obd_iocontrol(cmd,
-						  lmv->tgts[j]->ltd_exp,
-						  len, lk, uarg);
+						      lmv->tgts[j]->ltd_exp,
+						      len, lk, uarg);
 				return rc;
 			}
 			/* else: transient error.
@@ -924,8 +924,8 @@ static int lmv_iocontrol(unsigned int cmd, struct obd_export *exp,
 
 		/* copy UUID */
 		if (copy_to_user(data->ioc_pbuf2, obd2cli_tgt(mdc_obd),
-				     min((int) data->ioc_plen2,
-					 (int) sizeof(struct obd_uuid))))
+				 min((int) data->ioc_plen2,
+				     (int) sizeof(struct obd_uuid))))
 			return -EFAULT;
 
 		rc = obd_statfs(NULL, lmv->tgts[index]->ltd_exp, &stat_buf,
@@ -934,8 +934,8 @@ static int lmv_iocontrol(unsigned int cmd, struct obd_export *exp,
 		if (rc)
 			return rc;
 		if (copy_to_user(data->ioc_pbuf1, &stat_buf,
-				     min((int) data->ioc_plen1,
-					 (int) sizeof(stat_buf))))
+				 min((int) data->ioc_plen1,
+				     (int) sizeof(stat_buf))))
 			return -EFAULT;
 		break;
 	}
@@ -1020,10 +1020,10 @@ static int lmv_iocontrol(unsigned int cmd, struct obd_export *exp,
 
 		tgt = lmv_find_target(lmv, &op_data->op_fid1);
 		if (IS_ERR(tgt))
-				return PTR_ERR(tgt);
+			return PTR_ERR(tgt);
 
 		if (tgt->ltd_exp == NULL)
-				return -EINVAL;
+			return -EINVAL;
 
 		rc = obd_iocontrol(cmd, tgt->ltd_exp, len, karg, uarg);
 		break;
@@ -1069,7 +1069,7 @@ static int lmv_iocontrol(unsigned int cmd, struct obd_export *exp,
 				/* build a request with fids for this MDS */
 				reqlen = offsetof(typeof(*hur),
 						  hur_user_item[nr])
-					 + hur->hur_request.hr_data_len;
+						+ hur->hur_request.hr_data_len;
 				OBD_ALLOC_LARGE(req, reqlen);
 				if (req == NULL)
 					return -ENOMEM;
@@ -1134,9 +1134,9 @@ static int lmv_iocontrol(unsigned int cmd, struct obd_export *exp,
 			} else if (err) {
 				if (lmv->tgts[i]->ltd_active) {
 					CERROR("error: iocontrol MDC %s on MDT"
-					       "idx %d cmd %x: err = %d\n",
-						lmv->tgts[i]->ltd_uuid.uuid,
-						i, cmd, err);
+					       " idx %d cmd %x: err = %d\n",
+					       lmv->tgts[i]->ltd_uuid.uuid,
+					       i, cmd, err);
 					if (!rc)
 						rc = err;
 				}
@@ -1342,8 +1342,8 @@ static int lmv_setup(struct obd_device *obd, struct lustre_cfg *lcfg)
 					0444, &lmv_proc_target_fops, obd);
 		if (rc)
 			CWARN("%s: error adding LMV target_obd file: rc = %d\n",
-			       obd->obd_name, rc);
-       }
+			      obd->obd_name, rc);
+	}
 #endif
 	rc = fld_client_init(&lmv->lmv_fld, obd->obd_name,
 			     LUSTRE_CLI_FLD_HASH_DHT);
-- 
1.7.9.5


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

* [PATCH 14/39] staging/lustre/hsm: copy start error should set HP_FLAG_COMPLETED
  2013-11-14 16:32 [PATCH 00/39] staging/lustre: patch bomb 2 Peng Tao
                   ` (12 preceding siblings ...)
  2013-11-14 16:32 ` [PATCH 13/39] staging/lustre/lmv: update coding style Peng Tao
@ 2013-11-14 16:32 ` Peng Tao
  2013-11-14 16:32 ` [PATCH 15/39] staging/lustre/lov: Get the correct address of lmm_objects Peng Tao
                   ` (24 subsequent siblings)
  38 siblings, 0 replies; 42+ messages in thread
From: Peng Tao @ 2013-11-14 16:32 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: linux-kernel, Aurelien Degremont, Peng Tao, Andreas Dilger

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.

Lustre-change: http://review.whamcloud.com/7265
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3685
Signed-off-by: Aurelien Degremont <aurelien.degremont@cea.fr>
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: Peng Tao <bergwolf@gmail.com>
Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
---
 drivers/staging/lustre/lustre/llite/dir.c |    3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/staging/lustre/lustre/llite/dir.c b/drivers/staging/lustre/lustre/llite/dir.c
index 044aa095..f52c624 100644
--- a/drivers/staging/lustre/lustre/llite/dir.c
+++ b/drivers/staging/lustre/lustre/llite/dir.c
@@ -942,6 +942,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.9.5


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

* [PATCH 15/39] staging/lustre/lov: Get the correct address of lmm_objects
  2013-11-14 16:32 [PATCH 00/39] staging/lustre: patch bomb 2 Peng Tao
                   ` (13 preceding siblings ...)
  2013-11-14 16:32 ` [PATCH 14/39] staging/lustre/hsm: copy start error should set HP_FLAG_COMPLETED Peng Tao
@ 2013-11-14 16:32 ` Peng Tao
  2013-11-14 16:32 ` [PATCH 16/39] staging/lustre/lvfs: remove llog_lvfs.c and other lvfs code from llog Peng Tao
                   ` (23 subsequent siblings)
  38 siblings, 0 replies; 42+ messages in thread
From: Peng Tao @ 2013-11-14 16:32 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: linux-kernel, Swapnil Pimpale, Peng Tao, Andreas Dilger

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.

Lustre-change: http://review.whamcloud.com/7258
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3162
Signed-off-by: Swapnil Pimpale <spimpale@ddn.com>
Reviewed-by: John L. Hammond <john.hammond@intel.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Signed-off-by: Peng Tao <bergwolf@gmail.com>
Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
---
 drivers/staging/lustre/lustre/lov/lov_pack.c |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/staging/lustre/lustre/lov/lov_pack.c b/drivers/staging/lustre/lustre/lov/lov_pack.c
index 27ed27e..102a34d 100644
--- a/drivers/staging/lustre/lustre/lov/lov_pack.c
+++ b/drivers/staging/lustre/lustre/lov/lov_pack.c
@@ -641,8 +641,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.9.5


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

* [PATCH 16/39] staging/lustre/lvfs: remove llog_lvfs.c and other lvfs code from llog
  2013-11-14 16:32 [PATCH 00/39] staging/lustre: patch bomb 2 Peng Tao
                   ` (14 preceding siblings ...)
  2013-11-14 16:32 ` [PATCH 15/39] staging/lustre/lov: Get the correct address of lmm_objects Peng Tao
@ 2013-11-14 16:32 ` Peng Tao
  2013-11-14 16:32 ` [PATCH 17/39] staging/lustre/llite: reset writeback index in ll_writepages Peng Tao
                   ` (22 subsequent siblings)
  38 siblings, 0 replies; 42+ messages in thread
From: Peng Tao @ 2013-11-14 16:32 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: linux-kernel, James Simmons, Mikhail Pershin, Peng Tao, Andreas Dilger

From: James Simmons <uja.ornl@gmail.com>

- remove obdfilter/llog_lvfs.c
- remove lgh_file from llog_header

Lustre-change: http://review.whamcloud.com/5331
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-2158
Signed-off-by: Mikhail Pershin <mike.pershin@intel.com>
Signed-off-by: James Simmons <uja.ornl@gmail.com>
Reviewed-by: Keith Mannthey <keith.mannthey@intel.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Signed-off-by: Peng Tao <bergwolf@gmail.com>
Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
---
 .../lustre/lustre/include/linux/lustre_fsfilt.h    |   84 --
 drivers/staging/lustre/lustre/include/linux/lvfs.h |    5 -
 drivers/staging/lustre/lustre/include/lustre_log.h |    4 -
 drivers/staging/lustre/lustre/include/obd_class.h  |   10 -
 drivers/staging/lustre/lustre/lvfs/fsfilt_ext3.c   |  760 ------------------
 drivers/staging/lustre/lustre/obdclass/llog_cat.c  |   34 +-
 drivers/staging/lustre/lustre/obdclass/llog_lvfs.c |  847 --------------------
 7 files changed, 13 insertions(+), 1731 deletions(-)
 delete mode 100644 drivers/staging/lustre/lustre/lvfs/fsfilt_ext3.c
 delete mode 100644 drivers/staging/lustre/lustre/obdclass/llog_lvfs.c

diff --git a/drivers/staging/lustre/lustre/include/linux/lustre_fsfilt.h b/drivers/staging/lustre/lustre/include/linux/lustre_fsfilt.h
index 4da6e372..b250cce 100644
--- a/drivers/staging/lustre/lustre/include/linux/lustre_fsfilt.h
+++ b/drivers/staging/lustre/lustre/include/linux/lustre_fsfilt.h
@@ -49,24 +49,13 @@
 #include <obd.h>
 #include <obd_class.h>
 
-typedef void (*fsfilt_cb_t)(struct obd_device *obd, __u64 last_rcvd,
-			    void *data, int error);
-
 struct fsfilt_operations {
 	struct list_head fs_list;
 	struct module *fs_owner;
 	char   *fs_type;
-	char   *(* fs_getlabel)(struct super_block *sb);
-	void   *(* fs_start)(struct inode *inode, int op, void *desc_private,
-			     int logs);
-	int     (* fs_commit)(struct inode *inode, void *handle,int force_sync);
 	int     (* fs_map_inode_pages)(struct inode *inode, struct page **page,
 				       int pages, unsigned long *blocks,
 				       int create, struct mutex *sem);
-	int     (* fs_write_record)(struct file *, void *, int size, loff_t *,
-				    int force_sync);
-	int     (* fs_read_record)(struct file *, void *, int size, loff_t *);
-	int     (* fs_setup)(struct super_block *sb);
 };
 
 extern int fsfilt_register_ops(struct fsfilt_operations *fs_ops);
@@ -74,20 +63,6 @@ extern void fsfilt_unregister_ops(struct fsfilt_operations *fs_ops);
 extern struct fsfilt_operations *fsfilt_get_ops(const char *type);
 extern void fsfilt_put_ops(struct fsfilt_operations *fs_ops);
 
-static inline char *fsfilt_get_label(struct obd_device *obd,
-				     struct super_block *sb)
-{
-	if (obd->obd_fsops->fs_getlabel == NULL)
-		return NULL;
-	if (obd->obd_fsops->fs_getlabel(sb)[0] == '\0')
-		return NULL;
-
-	return obd->obd_fsops->fs_getlabel(sb);
-}
-
-#define FSFILT_OP_UNLINK		1
-#define FSFILT_OP_CANCEL_UNLINK	 10
-
 #define __fsfilt_check_slow(obd, start, msg)			      \
 do {								      \
 	if (cfs_time_before(jiffies, start + 15 * HZ))		\
@@ -109,63 +84,4 @@ do {						    \
 	start = jiffies;				\
 } while (0)
 
-static inline void *fsfilt_start_log(struct obd_device *obd,
-				     struct inode *inode, int op,
-				     struct obd_trans_info *oti, int logs)
-{
-	unsigned long now = jiffies;
-	void *parent_handle = oti ? oti->oti_handle : NULL;
-	void *handle;
-
-	handle = obd->obd_fsops->fs_start(inode, op, parent_handle, logs);
-	CDEBUG(D_INFO, "started handle %p (%p)\n", handle, parent_handle);
-
-	if (oti != NULL) {
-		if (parent_handle == NULL) {
-			oti->oti_handle = handle;
-		} else if (handle != parent_handle) {
-			CERROR("mismatch: parent %p, handle %p, oti %p\n",
-			       parent_handle, handle, oti);
-			LBUG();
-		}
-	}
-	fsfilt_check_slow(obd, now, "journal start");
-	return handle;
-}
-
-static inline int fsfilt_commit(struct obd_device *obd, struct inode *inode,
-				void *handle, int force_sync)
-{
-	unsigned long now = jiffies;
-	int rc = obd->obd_fsops->fs_commit(inode, handle, force_sync);
-	CDEBUG(D_INFO, "committing handle %p\n", handle);
-
-	fsfilt_check_slow(obd, now, "journal start");
-
-	return rc;
-}
-
-static inline int fsfilt_read_record(struct obd_device *obd, struct file *file,
-				     void *buf, loff_t size, loff_t *offs)
-{
-	return obd->obd_fsops->fs_read_record(file, buf, size, offs);
-}
-
-static inline int fsfilt_write_record(struct obd_device *obd, struct file *file,
-				      void *buf, loff_t size, loff_t *offs,
-				      int force_sync)
-{
-	return obd->obd_fsops->fs_write_record(file, buf, size,offs,force_sync);
-}
-
-static inline int fsfilt_setup(struct obd_device *obd, struct super_block *fs)
-{
-	if (obd->obd_fsops->fs_setup)
-		return obd->obd_fsops->fs_setup(fs);
-	return 0;
-}
-
-
-
-
 #endif
diff --git a/drivers/staging/lustre/lustre/include/linux/lvfs.h b/drivers/staging/lustre/lustre/include/linux/lvfs.h
index e61f1b8..2080508 100644
--- a/drivers/staging/lustre/lustre/include/linux/lvfs.h
+++ b/drivers/staging/lustre/lustre/include/linux/lvfs.h
@@ -64,10 +64,6 @@ struct lvfs_ucred {
 	struct md_identity     *luc_identity;
 };
 
-struct lvfs_callback_ops {
-	struct dentry *(*l_fid2dentry)(__u64 id_ino, __u32 gen, __u64 gr, void *data);
-};
-
 #define OBD_RUN_CTXT_MAGIC      0xC0FFEEAA
 #define OBD_CTXT_DEBUG	  /* development-only debugging */
 struct lvfs_run_ctxt {
@@ -76,7 +72,6 @@ struct lvfs_run_ctxt {
 	mm_segment_t	     fs;
 	struct lvfs_ucred	luc;
 	int		      ngroups;
-	struct lvfs_callback_ops cb_ops;
 	struct group_info       *group_info;
 	struct dt_device	*dt;
 #ifdef OBD_CTXT_DEBUG
diff --git a/drivers/staging/lustre/lustre/include/lustre_log.h b/drivers/staging/lustre/lustre/include/lustre_log.h
index 896c757..d45a27f 100644
--- a/drivers/staging/lustre/lustre/include/lustre_log.h
+++ b/drivers/staging/lustre/lustre/include/lustre_log.h
@@ -309,7 +309,6 @@ struct llog_handle {
 	spinlock_t		 lgh_hdr_lock; /* protect lgh_hdr data */
 	struct llog_logid	 lgh_id; /* id of this log */
 	struct llog_log_hdr	*lgh_hdr;
-	struct file		*lgh_file;
 	struct dt_object	*lgh_obj;
 	int			 lgh_last_idx;
 	int			 lgh_cur_idx; /* used during llog_process */
@@ -325,9 +324,6 @@ struct llog_handle {
 	atomic_t		 lgh_refcount;
 };
 
-/* llog_lvfs.c */
-extern struct llog_operations llog_lvfs_ops;
-
 /* llog_osd.c */
 extern struct llog_operations llog_osd_ops;
 int llog_osd_get_cat_list(const struct lu_env *env, struct dt_device *d,
diff --git a/drivers/staging/lustre/lustre/include/obd_class.h b/drivers/staging/lustre/lustre/include/obd_class.h
index 1c2ba19..8cb7cdf 100644
--- a/drivers/staging/lustre/lustre/include/obd_class.h
+++ b/drivers/staging/lustre/lustre/include/obd_class.h
@@ -1141,16 +1141,6 @@ static inline int obd_extent_calc(struct obd_export *exp,
 	return rc;
 }
 
-static inline struct dentry *
-obd_lvfs_fid2dentry(struct obd_export *exp, struct ost_id *oi, __u32 gen)
-{
-	struct lvfs_run_ctxt *ctxt = &exp->exp_obd->obd_lvfs_ctxt;
-	LASSERT(exp->exp_obd);
-
-	return ctxt->cb_ops.l_fid2dentry(ostid_id(oi), gen, ostid_seq(oi),
-					 exp->exp_obd);
-}
-
 /* @max_age is the oldest time in jiffies that we accept using a cached data.
  * If the cache is older than @max_age we will get a new value from the
  * target.  Use a value of "cfs_time_current() + HZ" to guarantee freshness. */
diff --git a/drivers/staging/lustre/lustre/lvfs/fsfilt_ext3.c b/drivers/staging/lustre/lustre/lvfs/fsfilt_ext3.c
deleted file mode 100644
index ee75994..0000000
--- a/drivers/staging/lustre/lustre/lvfs/fsfilt_ext3.c
+++ /dev/null
@@ -1,760 +0,0 @@
-/*
- * GPL HEADER START
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 only,
- * as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License version 2 for more details (a copy is included
- * in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU General Public License
- * version 2 along with this program; If not, see
- * http://www.sun.com/software/products/lustre/docs/GPLv2.pdf
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
- *
- * GPL HEADER END
- */
-/*
- * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved.
- * Use is subject to license terms.
- *
- * Copyright (c) 2011, 2012, Intel Corporation.
- */
-/*
- * This file is part of Lustre, http://www.lustre.org/
- * Lustre is a trademark of Sun Microsystems, Inc.
- *
- * lustre/lvfs/fsfilt_ext3.c
- *
- * Author: Andreas Dilger <adilger@clusterfs.com>
- */
-
-#define DEBUG_SUBSYSTEM S_FILTER
-
-#include <linux/init.h>
-#include <linux/module.h>
-#include <linux/fs.h>
-#include <linux/slab.h>
-#include <linux/pagemap.h>
-#include <ldiskfs/ldiskfs_config.h>
-#include <ext4/ext4.h>
-#include <ext4/ext4_jbd2.h>
-#include <linux/bitops.h>
-#include <linux/quota.h>
-
-#include <linux/libcfs/libcfs.h>
-#include <lustre_fsfilt.h>
-#include <obd.h>
-#include <linux/lustre_compat25.h>
-#include <linux/lprocfs_status.h>
-
-#include <ext4/ext4_extents.h>
-
-#ifdef HAVE_EXT_PBLOCK /* Name changed to ext4_ext_pblock for kernel 2.6.35 */
-#define ext3_ext_pblock(ex) ext_pblock((ex))
-#endif
-
-/* for kernels 2.6.18 and later */
-#define FSFILT_SINGLEDATA_TRANS_BLOCKS(sb) EXT3_SINGLEDATA_TRANS_BLOCKS(sb)
-
-#define fsfilt_ext3_ext_insert_extent(handle, inode, path, newext, flag) \
-	       ext3_ext_insert_extent(handle, inode, path, newext, flag)
-
-#define ext3_mb_discard_inode_preallocations(inode) \
-		 ext3_discard_preallocations(inode)
-
-#define fsfilt_log_start_commit(journal, tid) jbd2_log_start_commit(journal, tid)
-#define fsfilt_log_wait_commit(journal, tid) jbd2_log_wait_commit(journal, tid)
-
-static struct kmem_cache *fcb_cache;
-
-struct fsfilt_cb_data {
-	struct ext4_journal_cb_entry cb_jcb; /* private data - MUST BE FIRST */
-	fsfilt_cb_t cb_func;	    /* MDS/OBD completion function */
-	struct obd_device *cb_obd;      /* MDS/OBD completion device */
-	__u64 cb_last_rcvd;	     /* MDS/OST last committed operation */
-	void *cb_data;		  /* MDS/OST completion function data */
-};
-
-static char *fsfilt_ext3_get_label(struct super_block *sb)
-{
-	return EXT3_SB(sb)->s_es->s_volume_name;
-}
-
-/* kernel has ext4_blocks_for_truncate since linux-3.1.1 */
-# include <ext4/truncate.h>
-
-/*
- * We don't currently need any additional blocks for rmdir and
- * unlink transactions because we are storing the OST oa_id inside
- * the inode (which we will be changing anyways as part of this
- * transaction).
- */
-static void *fsfilt_ext3_start(struct inode *inode, int op, void *desc_private,
-			       int logs)
-{
-	/* For updates to the last received file */
-	int nblocks = FSFILT_SINGLEDATA_TRANS_BLOCKS(inode->i_sb);
-	journal_t *journal;
-	void *handle;
-
-	if (current->journal_info) {
-		CDEBUG(D_INODE, "increasing refcount on %p\n",
-		       current->journal_info);
-		goto journal_start;
-	}
-
-	switch(op) {
-	case FSFILT_OP_UNLINK:
-		/* delete one file + create/update logs for each stripe */
-		nblocks += EXT3_DELETE_TRANS_BLOCKS(inode->i_sb);
-		nblocks += (EXT3_INDEX_EXTRA_TRANS_BLOCKS +
-			    FSFILT_SINGLEDATA_TRANS_BLOCKS(inode->i_sb)) * logs;
-		break;
-	case FSFILT_OP_CANCEL_UNLINK:
-		LASSERT(logs == 1);
-
-		/* blocks for log header bitmap update OR
-		 * blocks for catalog header bitmap update + unlink of logs +
-		 * blocks for delete the inode (include blocks truncating). */
-		nblocks = (LLOG_CHUNK_SIZE >> inode->i_blkbits) +
-			  EXT3_DELETE_TRANS_BLOCKS(inode->i_sb) +
-			  ext4_blocks_for_truncate(inode) + 3;
-		break;
-	default: CERROR("unknown transaction start op %d\n", op);
-		LBUG();
-	}
-
-	LASSERT(current->journal_info == desc_private);
-	journal = EXT3_SB(inode->i_sb)->s_journal;
-	if (nblocks > journal->j_max_transaction_buffers) {
-		CWARN("too many credits %d for op %ux%u using %d instead\n",
-		       nblocks, op, logs, journal->j_max_transaction_buffers);
-		nblocks = journal->j_max_transaction_buffers;
-	}
-
- journal_start:
-	LASSERTF(nblocks > 0, "can't start %d credit transaction\n", nblocks);
-	handle = ext3_journal_start(inode, nblocks);
-
-	if (!IS_ERR(handle))
-		LASSERT(current->journal_info == handle);
-	else
-		CERROR("error starting handle for op %u (%u credits): rc %ld\n",
-		       op, nblocks, PTR_ERR(handle));
-	return handle;
-}
-
-static int fsfilt_ext3_commit(struct inode *inode, void *h, int force_sync)
-{
-	int rc;
-	handle_t *handle = h;
-
-	LASSERT(current->journal_info == handle);
-	if (force_sync)
-		handle->h_sync = 1; /* recovery likes this */
-
-	rc = ext3_journal_stop(handle);
-
-	return rc;
-}
-
-#ifndef EXT3_EXTENTS_FL
-#define EXT3_EXTENTS_FL		 0x00080000 /* Inode uses extents */
-#endif
-
-#ifndef EXT_ASSERT
-#define EXT_ASSERT(cond)  BUG_ON(!(cond))
-#endif
-
-#define EXT_GENERATION(inode)	   (EXT4_I(inode)->i_ext_generation)
-#define ext3_ext_base		   inode
-#define ext3_ext_base2inode(inode)      (inode)
-#define EXT_DEPTH(inode)		ext_depth(inode)
-#define fsfilt_ext3_ext_walk_space(inode, block, num, cb, cbdata) \
-			ext3_ext_walk_space(inode, block, num, cb, cbdata);
-
-struct bpointers {
-	unsigned long *blocks;
-	unsigned long start;
-	int num;
-	int init_num;
-	int create;
-};
-
-static long ext3_ext_find_goal(struct inode *inode, struct ext3_ext_path *path,
-			       unsigned long block, int *aflags)
-{
-	struct ext3_inode_info *ei = EXT3_I(inode);
-	unsigned long bg_start;
-	unsigned long colour;
-	int depth;
-
-	if (path) {
-		struct ext3_extent *ex;
-		depth = path->p_depth;
-
-		/* try to predict block placement */
-		if ((ex = path[depth].p_ext))
-			return ext4_ext_pblock(ex) + (block - le32_to_cpu(ex->ee_block));
-
-		/* it looks index is empty
-		 * try to find starting from index itself */
-		if (path[depth].p_bh)
-			return path[depth].p_bh->b_blocknr;
-	}
-
-	/* OK. use inode's group */
-	bg_start = (ei->i_block_group * EXT3_BLOCKS_PER_GROUP(inode->i_sb)) +
-		le32_to_cpu(EXT3_SB(inode->i_sb)->s_es->s_first_data_block);
-	colour = (current->pid % 16) *
-		(EXT3_BLOCKS_PER_GROUP(inode->i_sb) / 16);
-	return bg_start + colour + block;
-}
-
-#define ll_unmap_underlying_metadata(sb, blocknr) \
-	unmap_underlying_metadata((sb)->s_bdev, blocknr)
-
-#ifndef EXT3_MB_HINT_GROUP_ALLOC
-static unsigned long new_blocks(handle_t *handle, struct ext3_ext_base *base,
-				struct ext3_ext_path *path, unsigned long block,
-				unsigned long *count, int *err)
-{
-	unsigned long pblock, goal;
-	int aflags = 0;
-	struct inode *inode = ext3_ext_base2inode(base);
-
-	goal = ext3_ext_find_goal(inode, path, block, &aflags);
-	aflags |= 2; /* block have been already reserved */
-	pblock = ext3_mb_new_blocks(handle, inode, goal, count, aflags, err);
-	return pblock;
-
-}
-#else
-static unsigned long new_blocks(handle_t *handle, struct ext3_ext_base *base,
-				struct ext3_ext_path *path, unsigned long block,
-				unsigned long *count, int *err)
-{
-	struct inode *inode = ext3_ext_base2inode(base);
-	struct ext3_allocation_request ar;
-	unsigned long pblock;
-	int aflags;
-
-	/* find neighbour allocated blocks */
-	ar.lleft = block;
-	*err = ext3_ext_search_left(base, path, &ar.lleft, &ar.pleft);
-	if (*err)
-		return 0;
-	ar.lright = block;
-	*err = ext3_ext_search_right(base, path, &ar.lright, &ar.pright);
-	if (*err)
-		return 0;
-
-	/* allocate new block */
-	ar.goal = ext3_ext_find_goal(inode, path, block, &aflags);
-	ar.inode = inode;
-	ar.logical = block;
-	ar.len = *count;
-	ar.flags = EXT3_MB_HINT_DATA;
-	pblock = ext3_mb_new_blocks(handle, &ar, err);
-	*count = ar.len;
-	return pblock;
-}
-#endif
-
-static int ext3_ext_new_extent_cb(struct ext3_ext_base *base,
-				  struct ext3_ext_path *path,
-				  struct ext3_ext_cache *cex,
-#ifdef HAVE_EXT_PREPARE_CB_EXTENT
-				   struct ext3_extent *ex,
-#endif
-				  void *cbdata)
-{
-	struct bpointers *bp = cbdata;
-	struct inode *inode = ext3_ext_base2inode(base);
-	struct ext3_extent nex;
-	unsigned long pblock;
-	unsigned long tgen;
-	int err, i;
-	unsigned long count;
-	handle_t *handle;
-
-#ifdef EXT3_EXT_CACHE_EXTENT
-	if (cex->ec_type == EXT3_EXT_CACHE_EXTENT)
-#else
-	if ((cex->ec_len != 0) && (cex->ec_start != 0))
-#endif
-						   {
-		err = EXT_CONTINUE;
-		goto map;
-	}
-
-	if (bp->create == 0) {
-		i = 0;
-		if (cex->ec_block < bp->start)
-			i = bp->start - cex->ec_block;
-		if (i >= cex->ec_len)
-			CERROR("nothing to do?! i = %d, e_num = %u\n",
-					i, cex->ec_len);
-		for (; i < cex->ec_len && bp->num; i++) {
-			*(bp->blocks) = 0;
-			bp->blocks++;
-			bp->num--;
-			bp->start++;
-		}
-
-		return EXT_CONTINUE;
-	}
-
-	tgen = EXT_GENERATION(base);
-	count = ext3_ext_calc_credits_for_insert(base, path);
-
-	handle = ext3_journal_start(inode, count+EXT3_ALLOC_NEEDED+1);
-	if (IS_ERR(handle)) {
-		return PTR_ERR(handle);
-	}
-
-	if (tgen != EXT_GENERATION(base)) {
-		/* the tree has changed. so path can be invalid at moment */
-		ext3_journal_stop(handle);
-		return EXT_REPEAT;
-	}
-
-	/* In 2.6.32 kernel, ext4_ext_walk_space()'s callback func is not
-	 * protected by i_data_sem as whole. so we patch it to store
-	 * generation to path and now verify the tree hasn't changed */
-	down_write((&EXT4_I(inode)->i_data_sem));
-
-	/* validate extent, make sure the extent tree does not changed */
-	if (EXT_GENERATION(base) != path[0].p_generation) {
-		/* cex is invalid, try again */
-		up_write(&EXT4_I(inode)->i_data_sem);
-		ext3_journal_stop(handle);
-		return EXT_REPEAT;
-	}
-
-	count = cex->ec_len;
-	pblock = new_blocks(handle, base, path, cex->ec_block, &count, &err);
-	if (!pblock)
-		goto out;
-	EXT_ASSERT(count <= cex->ec_len);
-
-	/* insert new extent */
-	nex.ee_block = cpu_to_le32(cex->ec_block);
-	ext3_ext_store_pblock(&nex, pblock);
-	nex.ee_len = cpu_to_le16(count);
-	err = fsfilt_ext3_ext_insert_extent(handle, base, path, &nex, 0);
-	if (err) {
-		/* free data blocks we just allocated */
-		/* not a good idea to call discard here directly,
-		 * but otherwise we'd need to call it every free() */
-#ifdef EXT3_MB_HINT_GROUP_ALLOC
-		ext3_mb_discard_inode_preallocations(inode);
-#endif
-#ifdef HAVE_EXT_FREE_BLOCK_WITH_BUFFER_HEAD /* Introduced in 2.6.32-rc7 */
-		ext3_free_blocks(handle, inode, NULL, ext4_ext_pblock(&nex),
-				 cpu_to_le16(nex.ee_len), 0);
-#else
-		ext3_free_blocks(handle, inode, ext4_ext_pblock(&nex),
-				 cpu_to_le16(nex.ee_len), 0);
-#endif
-		goto out;
-	}
-
-	/*
-	 * Putting len of the actual extent we just inserted,
-	 * we are asking ext3_ext_walk_space() to continue
-	 * scaning after that block
-	 */
-	cex->ec_len = le16_to_cpu(nex.ee_len);
-	cex->ec_start = ext4_ext_pblock(&nex);
-	BUG_ON(le16_to_cpu(nex.ee_len) == 0);
-	BUG_ON(le32_to_cpu(nex.ee_block) != cex->ec_block);
-
-out:
-	up_write((&EXT4_I(inode)->i_data_sem));
-	ext3_journal_stop(handle);
-map:
-	if (err >= 0) {
-		/* map blocks */
-		if (bp->num == 0) {
-			CERROR("hmm. why do we find this extent?\n");
-			CERROR("initial space: %lu:%u\n",
-				bp->start, bp->init_num);
-#ifdef EXT3_EXT_CACHE_EXTENT
-			CERROR("current extent: %u/%u/%llu %d\n",
-				cex->ec_block, cex->ec_len,
-				(unsigned long long)cex->ec_start,
-				cex->ec_type);
-#else
-			CERROR("current extent: %u/%u/%llu\n",
-				cex->ec_block, cex->ec_len,
-				(unsigned long long)cex->ec_start);
-#endif
-		}
-		i = 0;
-		if (cex->ec_block < bp->start)
-			i = bp->start - cex->ec_block;
-		if (i >= cex->ec_len)
-			CERROR("nothing to do?! i = %d, e_num = %u\n",
-					i, cex->ec_len);
-		for (; i < cex->ec_len && bp->num; i++) {
-			*(bp->blocks) = cex->ec_start + i;
-#ifdef EXT3_EXT_CACHE_EXTENT
-			if (cex->ec_type != EXT3_EXT_CACHE_EXTENT)
-#else
-			if ((cex->ec_len == 0) || (cex->ec_start == 0))
-#endif
-									{
-				/* unmap any possible underlying metadata from
-				 * the block device mapping.  bug 6998. */
-				ll_unmap_underlying_metadata(inode->i_sb,
-							     *(bp->blocks));
-			}
-			bp->blocks++;
-			bp->num--;
-			bp->start++;
-		}
-	}
-	return err;
-}
-
-int fsfilt_map_nblocks(struct inode *inode, unsigned long block,
-		       unsigned long num, unsigned long *blocks,
-		       int create)
-{
-	struct ext3_ext_base *base = inode;
-	struct bpointers bp;
-	int err;
-
-	CDEBUG(D_OTHER, "blocks %lu-%lu requested for inode %u\n",
-	       block, block + num - 1, (unsigned) inode->i_ino);
-
-	bp.blocks = blocks;
-	bp.start = block;
-	bp.init_num = bp.num = num;
-	bp.create = create;
-
-	err = fsfilt_ext3_ext_walk_space(base, block, num,
-					 ext3_ext_new_extent_cb, &bp);
-	ext3_ext_invalidate_cache(base);
-
-	return err;
-}
-
-int fsfilt_ext3_map_ext_inode_pages(struct inode *inode, struct page **page,
-				    int pages, unsigned long *blocks,
-				    int create)
-{
-	int blocks_per_page = PAGE_CACHE_SIZE >> inode->i_blkbits;
-	int rc = 0, i = 0;
-	struct page *fp = NULL;
-	int clen = 0;
-
-	CDEBUG(D_OTHER, "inode %lu: map %d pages from %lu\n",
-		inode->i_ino, pages, (*page)->index);
-
-	/* pages are sorted already. so, we just have to find
-	 * contig. space and process them properly */
-	while (i < pages) {
-		if (fp == NULL) {
-			/* start new extent */
-			fp = *page++;
-			clen = 1;
-			i++;
-			continue;
-		} else if (fp->index + clen == (*page)->index) {
-			/* continue the extent */
-			page++;
-			clen++;
-			i++;
-			continue;
-		}
-
-		/* process found extent */
-		rc = fsfilt_map_nblocks(inode, fp->index * blocks_per_page,
-					clen * blocks_per_page, blocks,
-					create);
-		if (rc)
-			GOTO(cleanup, rc);
-
-		/* look for next extent */
-		fp = NULL;
-		blocks += blocks_per_page * clen;
-	}
-
-	if (fp)
-		rc = fsfilt_map_nblocks(inode, fp->index * blocks_per_page,
-					clen * blocks_per_page, blocks,
-					create);
-cleanup:
-	return rc;
-}
-
-int fsfilt_ext3_map_bm_inode_pages(struct inode *inode, struct page **page,
-				   int pages, unsigned long *blocks,
-				   int create)
-{
-	int blocks_per_page = PAGE_CACHE_SIZE >> inode->i_blkbits;
-	unsigned long *b;
-	int rc = 0, i;
-
-	for (i = 0, b = blocks; i < pages; i++, page++) {
-		rc = ext3_map_inode_page(inode, *page, b, create);
-		if (rc) {
-			CERROR("ino %lu, blk %lu create %d: rc %d\n",
-			       inode->i_ino, *b, create, rc);
-			break;
-		}
-
-		b += blocks_per_page;
-	}
-	return rc;
-}
-
-int fsfilt_ext3_map_inode_pages(struct inode *inode, struct page **page,
-				int pages, unsigned long *blocks,
-				int create, struct mutex *optional_mutex)
-{
-	int rc;
-
-	if (EXT3_I(inode)->i_flags & EXT3_EXTENTS_FL) {
-		rc = fsfilt_ext3_map_ext_inode_pages(inode, page, pages,
-						     blocks, create);
-		return rc;
-	}
-	if (optional_mutex != NULL)
-		mutex_lock(optional_mutex);
-	rc = fsfilt_ext3_map_bm_inode_pages(inode, page, pages, blocks, create);
-	if (optional_mutex != NULL)
-		mutex_unlock(optional_mutex);
-
-	return rc;
-}
-
-int fsfilt_ext3_read(struct inode *inode, void *buf, int size, loff_t *offs)
-{
-	unsigned long block;
-	struct buffer_head *bh;
-	int err, blocksize, csize, boffs, osize = size;
-
-	/* prevent reading after eof */
-	spin_lock(&inode->i_lock);
-	if (i_size_read(inode) < *offs + size) {
-		size = i_size_read(inode) - *offs;
-		spin_unlock(&inode->i_lock);
-		if (size < 0) {
-			CDEBUG(D_EXT2, "size %llu is too short for read @%llu\n",
-			       i_size_read(inode), *offs);
-			return -EBADR;
-		} else if (size == 0) {
-			return 0;
-		}
-	} else {
-		spin_unlock(&inode->i_lock);
-	}
-
-	blocksize = 1 << inode->i_blkbits;
-
-	while (size > 0) {
-		block = *offs >> inode->i_blkbits;
-		boffs = *offs & (blocksize - 1);
-		csize = min(blocksize - boffs, size);
-		bh = ext3_bread(NULL, inode, block, 0, &err);
-		if (!bh) {
-			CERROR("can't read block: %d\n", err);
-			return err;
-		}
-
-		memcpy(buf, bh->b_data + boffs, csize);
-		brelse(bh);
-
-		*offs += csize;
-		buf += csize;
-		size -= csize;
-	}
-	return osize;
-}
-EXPORT_SYMBOL(fsfilt_ext3_read);
-
-static int fsfilt_ext3_read_record(struct file * file, void *buf,
-				   int size, loff_t *offs)
-{
-	int rc;
-	rc = fsfilt_ext3_read(file->f_dentry->d_inode, buf, size, offs);
-	if (rc > 0)
-		rc = 0;
-	return rc;
-}
-
-int fsfilt_ext3_write_handle(struct inode *inode, void *buf, int bufsize,
-				loff_t *offs, handle_t *handle)
-{
-	struct buffer_head *bh = NULL;
-	loff_t old_size = i_size_read(inode), offset = *offs;
-	loff_t new_size = i_size_read(inode);
-	unsigned long block;
-	int err = 0, blocksize = 1 << inode->i_blkbits, size, boffs;
-
-	while (bufsize > 0) {
-		if (bh != NULL)
-			brelse(bh);
-
-		block = offset >> inode->i_blkbits;
-		boffs = offset & (blocksize - 1);
-		size = min(blocksize - boffs, bufsize);
-		bh = ext3_bread(handle, inode, block, 1, &err);
-		if (!bh) {
-			CERROR("can't read/create block: %d\n", err);
-			break;
-		}
-
-		err = ext3_journal_get_write_access(handle, bh);
-		if (err) {
-			CERROR("journal_get_write_access() returned error %d\n",
-			       err);
-			break;
-		}
-		LASSERT(bh->b_data + boffs + size <= bh->b_data + bh->b_size);
-		memcpy(bh->b_data + boffs, buf, size);
-		err = ext3_journal_dirty_metadata(handle, bh);
-		if (err) {
-			CERROR("journal_dirty_metadata() returned error %d\n",
-			       err);
-			break;
-		}
-		if (offset + size > new_size)
-			new_size = offset + size;
-		offset += size;
-		bufsize -= size;
-		buf += size;
-	}
-	if (bh)
-		brelse(bh);
-
-	/* correct in-core and on-disk sizes */
-	if (new_size > i_size_read(inode)) {
-		spin_lock(&inode->i_lock);
-		if (new_size > i_size_read(inode))
-			i_size_write(inode, new_size);
-		if (i_size_read(inode) > EXT3_I(inode)->i_disksize)
-			EXT3_I(inode)->i_disksize = i_size_read(inode);
-		if (i_size_read(inode) > old_size) {
-			spin_unlock(&inode->i_lock);
-			mark_inode_dirty(inode);
-		} else {
-			spin_unlock(&inode->i_lock);
-		}
-	}
-
-	if (err == 0)
-		*offs = offset;
-	return err;
-}
-EXPORT_SYMBOL(fsfilt_ext3_write_handle);
-
-static int fsfilt_ext3_write_record(struct file *file, void *buf, int bufsize,
-				    loff_t *offs, int force_sync)
-{
-	struct inode *inode = file->f_dentry->d_inode;
-	handle_t *handle;
-	int err, block_count = 0, blocksize;
-
-	/* Determine how many transaction credits are needed */
-	blocksize = 1 << inode->i_blkbits;
-	block_count = (*offs & (blocksize - 1)) + bufsize;
-	block_count = (block_count + blocksize - 1) >> inode->i_blkbits;
-
-	handle = ext3_journal_start(inode,
-			block_count * EXT3_DATA_TRANS_BLOCKS(inode->i_sb) + 2);
-	if (IS_ERR(handle)) {
-		CERROR("can't start transaction for %d blocks (%d bytes)\n",
-		       block_count * EXT3_DATA_TRANS_BLOCKS(inode->i_sb) + 2,
-		       bufsize);
-		return PTR_ERR(handle);
-	}
-
-	err = fsfilt_ext3_write_handle(inode, buf, bufsize, offs, handle);
-
-	if (!err && force_sync)
-		handle->h_sync = 1; /* recovery likes this */
-
-	ext3_journal_stop(handle);
-
-	return err;
-}
-
-static int fsfilt_ext3_setup(struct super_block *sb)
-{
-	if (!EXT3_HAS_COMPAT_FEATURE(sb,
-				EXT3_FEATURE_COMPAT_HAS_JOURNAL)) {
-		CERROR("ext3 mounted without journal\n");
-		return -EINVAL;
-	}
-
-#ifdef S_PDIROPS
-	CWARN("Enabling PDIROPS\n");
-	set_opt(EXT3_SB(sb)->s_mount_opt, PDIROPS);
-	sb->s_flags |= S_PDIROPS;
-#endif
-	if (!EXT3_HAS_COMPAT_FEATURE(sb, EXT3_FEATURE_COMPAT_DIR_INDEX))
-		CWARN("filesystem doesn't have dir_index feature enabled\n");
-	return 0;
-}
-static struct fsfilt_operations fsfilt_ext3_ops = {
-	.fs_type		= "ext3",
-	.fs_owner	       = THIS_MODULE,
-	.fs_getlabel	    = fsfilt_ext3_get_label,
-	.fs_start	       = fsfilt_ext3_start,
-	.fs_commit	      = fsfilt_ext3_commit,
-	.fs_map_inode_pages     = fsfilt_ext3_map_inode_pages,
-	.fs_write_record	= fsfilt_ext3_write_record,
-	.fs_read_record	 = fsfilt_ext3_read_record,
-	.fs_setup	       = fsfilt_ext3_setup,
-};
-
-static int __init fsfilt_ext3_init(void)
-{
-	int rc;
-
-	fcb_cache = kmem_cache_create("fsfilt_ext3_fcb",
-					 sizeof(struct fsfilt_cb_data), 0, 0);
-	if (!fcb_cache) {
-		CERROR("error allocating fsfilt journal callback cache\n");
-		GOTO(out, rc = -ENOMEM);
-	}
-
-	rc = fsfilt_register_ops(&fsfilt_ext3_ops);
-
-	if (rc) {
-		int err = kmem_cache_destroy(fcb_cache);
-		LASSERTF(err == 0, "error destroying new cache: rc %d\n", err);
-	}
-out:
-	return rc;
-}
-
-static void __exit fsfilt_ext3_exit(void)
-{
-	int rc;
-
-	fsfilt_unregister_ops(&fsfilt_ext3_ops);
-	rc = kmem_cache_destroy(fcb_cache);
-	LASSERTF(rc == 0, "couldn't destroy fcb_cache slab\n");
-}
-
-module_init(fsfilt_ext3_init);
-module_exit(fsfilt_ext3_exit);
-
-MODULE_AUTHOR("Sun Microsystems, Inc. <http://www.lustre.org/>");
-MODULE_DESCRIPTION("Lustre ext3 Filesystem Helper v0.1");
-MODULE_LICENSE("GPL");
diff --git a/drivers/staging/lustre/lustre/obdclass/llog_cat.c b/drivers/staging/lustre/lustre/obdclass/llog_cat.c
index c0f3af7..c813a88 100644
--- a/drivers/staging/lustre/lustre/obdclass/llog_cat.c
+++ b/drivers/staging/lustre/lustre/obdclass/llog_cat.c
@@ -444,31 +444,23 @@ int llog_cat_add(const struct lu_env *env, struct llog_handle *cathandle,
 	LASSERT(ctxt);
 	LASSERT(ctxt->loc_exp);
 
-	if (cathandle->lgh_obj != NULL) {
-		dt = ctxt->loc_exp->exp_obd->obd_lvfs_ctxt.dt;
-		LASSERT(dt);
+	LASSERT(cathandle->lgh_obj != NULL);
+	dt = lu2dt_dev(cathandle->lgh_obj->do_lu.lo_dev);
 
-		th = dt_trans_create(env, dt);
-		if (IS_ERR(th))
-			return PTR_ERR(th);
+	th = dt_trans_create(env, dt);
+	if (IS_ERR(th))
+		return PTR_ERR(th);
 
-		rc = llog_cat_declare_add_rec(env, cathandle, rec, th);
-		if (rc)
-			GOTO(out_trans, rc);
+	rc = llog_cat_declare_add_rec(env, cathandle, rec, th);
+	if (rc)
+		GOTO(out_trans, rc);
 
-		rc = dt_trans_start_local(env, dt, th);
-		if (rc)
-			GOTO(out_trans, rc);
-		rc = llog_cat_add_rec(env, cathandle, rec, reccookie, buf, th);
+	rc = dt_trans_start_local(env, dt, th);
+	if (rc)
+		GOTO(out_trans, rc);
+	rc = llog_cat_add_rec(env, cathandle, rec, reccookie, buf, th);
 out_trans:
-		dt_trans_stop(env, dt, th);
-	} else { /* lvfs compat code */
-		LASSERT(cathandle->lgh_file != NULL);
-		rc = llog_cat_declare_add_rec(env, cathandle, rec, th);
-		if (rc == 0)
-			rc = llog_cat_add_rec(env, cathandle, rec, reccookie,
-					      buf, th);
-	}
+	dt_trans_stop(env, dt, th);
 	return rc;
 }
 EXPORT_SYMBOL(llog_cat_add);
diff --git a/drivers/staging/lustre/lustre/obdclass/llog_lvfs.c b/drivers/staging/lustre/lustre/obdclass/llog_lvfs.c
deleted file mode 100644
index 5385d8e..0000000
--- a/drivers/staging/lustre/lustre/obdclass/llog_lvfs.c
+++ /dev/null
@@ -1,847 +0,0 @@
-/*
- * GPL HEADER START
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 only,
- * as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License version 2 for more details (a copy is included
- * in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU General Public License
- * version 2 along with this program; If not, see
- * http://www.sun.com/software/products/lustre/docs/GPLv2.pdf
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
- *
- * GPL HEADER END
- */
-/*
- * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
- * Use is subject to license terms.
- *
- * Copyright (c) 2011, 2012, Intel Corporation.
- */
-/*
- * This file is part of Lustre, http://www.lustre.org/
- * Lustre is a trademark of Sun Microsystems, Inc.
- *
- * lustre/obdclass/llog_lvfs.c
- *
- * OST<->MDS recovery logging infrastructure.
- * Invariants in implementation:
- * - we do not share logs among different OST<->MDS connections, so that
- *   if an OST or MDS fails it need only look at log(s) relevant to itself
- *
- * Author: Andreas Dilger <adilger@clusterfs.com>
- */
-
-#define DEBUG_SUBSYSTEM S_LOG
-
-
-#include <obd.h>
-#include <obd_class.h>
-#include <lustre_log.h>
-#include <obd_ost.h>
-#include <linux/list.h>
-#include <lvfs.h>
-#include <lustre_fsfilt.h>
-#include <lustre_disk.h>
-#include "llog_internal.h"
-
-#if  defined(LLOG_LVFS)
-
-static int llog_lvfs_pad(struct obd_device *obd, struct l_file *file,
-				int len, int index)
-{
-	struct llog_rec_hdr rec = { 0 };
-	struct llog_rec_tail tail;
-	int rc;
-
-	LASSERT(len >= LLOG_MIN_REC_SIZE && (len & 0x7) == 0);
-
-	tail.lrt_len = rec.lrh_len = len;
-	tail.lrt_index = rec.lrh_index = index;
-	rec.lrh_type = LLOG_PAD_MAGIC;
-
-	rc = fsfilt_write_record(obd, file, &rec, sizeof(rec), &file->f_pos, 0);
-	if (rc) {
-		CERROR("error writing padding record: rc %d\n", rc);
-		goto out;
-	}
-
-	file->f_pos += len - sizeof(rec) - sizeof(tail);
-	rc = fsfilt_write_record(obd, file, &tail, sizeof(tail),&file->f_pos,0);
-	if (rc) {
-		CERROR("error writing padding record: rc %d\n", rc);
-		goto out;
-	}
-
- out:
-	return rc;
-}
-
-static int llog_lvfs_write_blob(struct obd_device *obd, struct l_file *file,
-				struct llog_rec_hdr *rec, void *buf, loff_t off)
-{
-	int rc;
-	struct llog_rec_tail end;
-	loff_t saved_off = file->f_pos;
-	int buflen = rec->lrh_len;
-
-	file->f_pos = off;
-
-	if (buflen == 0)
-		CWARN("0-length record\n");
-
-	if (!buf) {
-		rc = fsfilt_write_record(obd, file, rec, buflen,&file->f_pos,0);
-		if (rc) {
-			CERROR("error writing log record: rc %d\n", rc);
-			goto out;
-		}
-		GOTO(out, rc = 0);
-	}
-
-	/* the buf case */
-	rec->lrh_len = sizeof(*rec) + buflen + sizeof(end);
-	rc = fsfilt_write_record(obd, file, rec, sizeof(*rec), &file->f_pos, 0);
-	if (rc) {
-		CERROR("error writing log hdr: rc %d\n", rc);
-		goto out;
-	}
-
-	rc = fsfilt_write_record(obd, file, buf, buflen, &file->f_pos, 0);
-	if (rc) {
-		CERROR("error writing log buffer: rc %d\n", rc);
-		goto out;
-	}
-
-	end.lrt_len = rec->lrh_len;
-	end.lrt_index = rec->lrh_index;
-	rc = fsfilt_write_record(obd, file, &end, sizeof(end), &file->f_pos, 0);
-	if (rc) {
-		CERROR("error writing log tail: rc %d\n", rc);
-		goto out;
-	}
-
-	rc = 0;
- out:
-	if (saved_off > file->f_pos)
-		file->f_pos = saved_off;
-	LASSERT(rc <= 0);
-	return rc;
-}
-
-static int llog_lvfs_read_blob(struct obd_device *obd, struct l_file *file,
-				void *buf, int size, loff_t off)
-{
-	loff_t offset = off;
-	int rc;
-
-	rc = fsfilt_read_record(obd, file, buf, size, &offset);
-	if (rc) {
-		CERROR("error reading log record: rc %d\n", rc);
-		return rc;
-	}
-	return 0;
-}
-
-static int llog_lvfs_read_header(const struct lu_env *env,
-				 struct llog_handle *handle)
-{
-	struct obd_device *obd;
-	int rc;
-
-	LASSERT(sizeof(*handle->lgh_hdr) == LLOG_CHUNK_SIZE);
-
-	obd = handle->lgh_ctxt->loc_exp->exp_obd;
-
-	if (i_size_read(handle->lgh_file->f_dentry->d_inode) == 0) {
-		CDEBUG(D_HA, "not reading header from 0-byte log\n");
-		return LLOG_EEMPTY;
-	}
-
-	rc = llog_lvfs_read_blob(obd, handle->lgh_file, handle->lgh_hdr,
-				 LLOG_CHUNK_SIZE, 0);
-	if (rc) {
-		CERROR("error reading log header from %.*s\n",
-		       handle->lgh_file->f_dentry->d_name.len,
-		       handle->lgh_file->f_dentry->d_name.name);
-	} else {
-		struct llog_rec_hdr *llh_hdr = &handle->lgh_hdr->llh_hdr;
-
-		if (LLOG_REC_HDR_NEEDS_SWABBING(llh_hdr))
-			lustre_swab_llog_hdr(handle->lgh_hdr);
-
-		if (llh_hdr->lrh_type != LLOG_HDR_MAGIC) {
-			CERROR("bad log %.*s header magic: %#x (expected %#x)\n",
-			       handle->lgh_file->f_dentry->d_name.len,
-			       handle->lgh_file->f_dentry->d_name.name,
-			       llh_hdr->lrh_type, LLOG_HDR_MAGIC);
-			rc = -EIO;
-		} else if (llh_hdr->lrh_len != LLOG_CHUNK_SIZE) {
-			CERROR("incorrectly sized log %.*s header: %#x "
-			       "(expected %#x)\n",
-			       handle->lgh_file->f_dentry->d_name.len,
-			       handle->lgh_file->f_dentry->d_name.name,
-			       llh_hdr->lrh_len, LLOG_CHUNK_SIZE);
-			CERROR("you may need to re-run lconf --write_conf.\n");
-			rc = -EIO;
-		}
-	}
-
-	handle->lgh_last_idx = handle->lgh_hdr->llh_tail.lrt_index;
-	handle->lgh_file->f_pos = i_size_read(handle->lgh_file->f_dentry->d_inode);
-
-	return rc;
-}
-
-/* returns negative in on error; 0 if success && reccookie == 0; 1 otherwise */
-/* appends if idx == -1, otherwise overwrites record idx. */
-static int llog_lvfs_write_rec(const struct lu_env *env,
-			       struct llog_handle *loghandle,
-			       struct llog_rec_hdr *rec,
-			       struct llog_cookie *reccookie, int cookiecount,
-			       void *buf, int idx, struct thandle *th)
-{
-	struct llog_log_hdr *llh;
-	int reclen = rec->lrh_len, index, rc;
-	struct llog_rec_tail *lrt;
-	struct obd_device *obd;
-	struct file *file;
-	size_t left;
-
-	llh = loghandle->lgh_hdr;
-	file = loghandle->lgh_file;
-	obd = loghandle->lgh_ctxt->loc_exp->exp_obd;
-
-	/* record length should not bigger than LLOG_CHUNK_SIZE */
-	if (buf)
-		rc = (reclen > LLOG_CHUNK_SIZE - sizeof(struct llog_rec_hdr) -
-		      sizeof(struct llog_rec_tail)) ? -E2BIG : 0;
-	else
-		rc = (reclen > LLOG_CHUNK_SIZE) ? -E2BIG : 0;
-	if (rc)
-		return rc;
-
-	if (buf)
-		/* write_blob adds header and tail to lrh_len. */
-		reclen = sizeof(*rec) + rec->lrh_len +
-			 sizeof(struct llog_rec_tail);
-
-	if (idx != -1) {
-		loff_t saved_offset;
-
-		/* no header: only allowed to insert record 1 */
-		if (idx != 1 && !i_size_read(file->f_dentry->d_inode)) {
-			CERROR("idx != -1 in empty log\n");
-			LBUG();
-		}
-
-		if (idx && llh->llh_size && llh->llh_size != rec->lrh_len)
-			return -EINVAL;
-
-		if (!ext2_test_bit(idx, llh->llh_bitmap))
-			CERROR("Modify unset record %u\n", idx);
-		if (idx != rec->lrh_index)
-			CERROR("Index mismatch %d %u\n", idx, rec->lrh_index);
-
-		rc = llog_lvfs_write_blob(obd, file, &llh->llh_hdr, NULL, 0);
-		/* we are done if we only write the header or on error */
-		if (rc || idx == 0)
-			return rc;
-
-		if (buf) {
-			/* We assume that caller has set lgh_cur_* */
-			saved_offset = loghandle->lgh_cur_offset;
-			CDEBUG(D_OTHER,
-			       "modify record "DOSTID": idx:%d/%u/%d, len:%u "
-			       "offset %llu\n",
-			       POSTID(&loghandle->lgh_id.lgl_oi), idx, rec->lrh_index,
-			       loghandle->lgh_cur_idx, rec->lrh_len,
-			       (long long)(saved_offset - sizeof(*llh)));
-			if (rec->lrh_index != loghandle->lgh_cur_idx) {
-				CERROR("modify idx mismatch %u/%d\n",
-				       idx, loghandle->lgh_cur_idx);
-				return -EFAULT;
-			}
-		} else {
-			/* Assumes constant lrh_len */
-			saved_offset = sizeof(*llh) + (idx - 1) * reclen;
-		}
-
-		rc = llog_lvfs_write_blob(obd, file, rec, buf, saved_offset);
-		if (rc == 0 && reccookie) {
-			reccookie->lgc_lgl = loghandle->lgh_id;
-			reccookie->lgc_index = idx;
-			rc = 1;
-		}
-		return rc;
-	}
-
-	/* Make sure that records don't cross a chunk boundary, so we can
-	 * process them page-at-a-time if needed.  If it will cross a chunk
-	 * boundary, write in a fake (but referenced) entry to pad the chunk.
-	 *
-	 * We know that llog_current_log() will return a loghandle that is
-	 * big enough to hold reclen, so all we care about is padding here.
-	 */
-	left = LLOG_CHUNK_SIZE - (file->f_pos & (LLOG_CHUNK_SIZE - 1));
-
-	/* NOTE: padding is a record, but no bit is set */
-	if (left != 0 && left != reclen &&
-	    left < (reclen + LLOG_MIN_REC_SIZE)) {
-		 index = loghandle->lgh_last_idx + 1;
-		 rc = llog_lvfs_pad(obd, file, left, index);
-		 if (rc)
-			 return rc;
-		 loghandle->lgh_last_idx++; /*for pad rec*/
-	 }
-	 /* if it's the last idx in log file, then return -ENOSPC */
-	 if (loghandle->lgh_last_idx >= LLOG_BITMAP_SIZE(llh) - 1)
-		 return -ENOSPC;
-	loghandle->lgh_last_idx++;
-	index = loghandle->lgh_last_idx;
-	LASSERT(index < LLOG_BITMAP_SIZE(llh));
-	rec->lrh_index = index;
-	if (buf == NULL) {
-		lrt = (struct llog_rec_tail *)
-			((char *)rec + rec->lrh_len - sizeof(*lrt));
-		lrt->lrt_len = rec->lrh_len;
-		lrt->lrt_index = rec->lrh_index;
-	}
-	/*The caller should make sure only 1 process access the lgh_last_idx,
-	 *Otherwise it might hit the assert.*/
-	LASSERT(index < LLOG_BITMAP_SIZE(llh));
-	spin_lock(&loghandle->lgh_hdr_lock);
-	if (ext2_set_bit(index, llh->llh_bitmap)) {
-		CERROR("argh, index %u already set in log bitmap?\n", index);
-		spin_unlock(&loghandle->lgh_hdr_lock);
-		LBUG(); /* should never happen */
-	}
-	llh->llh_count++;
-	spin_unlock(&loghandle->lgh_hdr_lock);
-	llh->llh_tail.lrt_index = index;
-
-	rc = llog_lvfs_write_blob(obd, file, &llh->llh_hdr, NULL, 0);
-	if (rc)
-		return rc;
-
-	rc = llog_lvfs_write_blob(obd, file, rec, buf, file->f_pos);
-	if (rc)
-		return rc;
-
-	CDEBUG(D_RPCTRACE, "added record "DOSTID": idx: %u, %u \n",
-	       POSTID(&loghandle->lgh_id.lgl_oi), index, rec->lrh_len);
-	if (rc == 0 && reccookie) {
-		reccookie->lgc_lgl = loghandle->lgh_id;
-		reccookie->lgc_index = index;
-		if ((rec->lrh_type == MDS_UNLINK_REC) ||
-		    (rec->lrh_type == MDS_SETATTR64_REC))
-			reccookie->lgc_subsys = LLOG_MDS_OST_ORIG_CTXT;
-		else if (rec->lrh_type == OST_SZ_REC)
-			reccookie->lgc_subsys = LLOG_SIZE_ORIG_CTXT;
-		else
-			reccookie->lgc_subsys = -1;
-		rc = 1;
-	}
-	if (rc == 0 && rec->lrh_type == LLOG_GEN_REC)
-		rc = 1;
-
-	return rc;
-}
-
-/* We can skip reading at least as many log blocks as the number of
-* minimum sized log records we are skipping.  If it turns out
-* that we are not far enough along the log (because the
-* actual records are larger than minimum size) we just skip
-* some more records. */
-
-static void llog_skip_over(__u64 *off, int curr, int goal)
-{
-	if (goal <= curr)
-		return;
-	*off = (*off + (goal-curr-1) * LLOG_MIN_REC_SIZE) &
-		~(LLOG_CHUNK_SIZE - 1);
-}
-
-
-/* sets:
- *  - cur_offset to the furthest point read in the log file
- *  - cur_idx to the log index preceeding cur_offset
- * returns -EIO/-EINVAL on error
- */
-static int llog_lvfs_next_block(const struct lu_env *env,
-				struct llog_handle *loghandle, int *cur_idx,
-				int next_idx, __u64 *cur_offset, void *buf,
-				int len)
-{
-	int rc;
-
-	if (len == 0 || len & (LLOG_CHUNK_SIZE - 1))
-		return -EINVAL;
-
-	CDEBUG(D_OTHER, "looking for log index %u (cur idx %u off "LPU64")\n",
-	       next_idx, *cur_idx, *cur_offset);
-
-	while (*cur_offset < i_size_read(loghandle->lgh_file->f_dentry->d_inode)) {
-		struct llog_rec_hdr *rec, *last_rec;
-		struct llog_rec_tail *tail;
-		loff_t ppos;
-		int llen;
-
-		llog_skip_over(cur_offset, *cur_idx, next_idx);
-
-		/* read up to next LLOG_CHUNK_SIZE block */
-		ppos = *cur_offset;
-		llen = LLOG_CHUNK_SIZE - (*cur_offset & (LLOG_CHUNK_SIZE - 1));
-		rc = fsfilt_read_record(loghandle->lgh_ctxt->loc_exp->exp_obd,
-					loghandle->lgh_file, buf, llen,
-					cur_offset);
-		if (rc < 0) {
-			CERROR("Cant read llog block at log id "DOSTID
-			       "/%u offset "LPU64"\n",
-			       POSTID(&loghandle->lgh_id.lgl_oi),
-			       loghandle->lgh_id.lgl_ogen,
-			       *cur_offset);
-			return rc;
-		}
-
-		/* put number of bytes read into rc to make code simpler */
-		rc = *cur_offset - ppos;
-		if (rc < len) {
-			/* signal the end of the valid buffer to llog_process */
-			memset(buf + rc, 0, len - rc);
-		}
-
-		if (rc == 0) /* end of file, nothing to do */
-			return 0;
-
-		if (rc < sizeof(*tail)) {
-			CERROR("Invalid llog block at log id "DOSTID"/%u offset"
-			       LPU64"\n", POSTID(&loghandle->lgh_id.lgl_oi),
-			       loghandle->lgh_id.lgl_ogen, *cur_offset);
-			return -EINVAL;
-		}
-
-		rec = buf;
-		if (LLOG_REC_HDR_NEEDS_SWABBING(rec))
-			lustre_swab_llog_rec(rec);
-
-		tail = (struct llog_rec_tail *)(buf + rc -
-						sizeof(struct llog_rec_tail));
-
-		/* get the last record in block */
-		last_rec = (struct llog_rec_hdr *)(buf + rc -
-						   le32_to_cpu(tail->lrt_len));
-
-		if (LLOG_REC_HDR_NEEDS_SWABBING(last_rec))
-			lustre_swab_llog_rec(last_rec);
-		LASSERT(last_rec->lrh_index == tail->lrt_index);
-
-		*cur_idx = tail->lrt_index;
-
-		/* this shouldn't happen */
-		if (tail->lrt_index == 0) {
-			CERROR("Invalid llog tail at log id "DOSTID"/%u offset "
-			       LPU64"\n", POSTID(&loghandle->lgh_id.lgl_oi),
-			       loghandle->lgh_id.lgl_ogen, *cur_offset);
-			return -EINVAL;
-		}
-		if (tail->lrt_index < next_idx)
-			continue;
-
-		/* sanity check that the start of the new buffer is no farther
-		 * than the record that we wanted.  This shouldn't happen. */
-		if (rec->lrh_index > next_idx) {
-			CERROR("missed desired record? %u > %u\n",
-			       rec->lrh_index, next_idx);
-			return -ENOENT;
-		}
-		return 0;
-	}
-	return -EIO;
-}
-
-static int llog_lvfs_prev_block(const struct lu_env *env,
-				struct llog_handle *loghandle,
-				int prev_idx, void *buf, int len)
-{
-	__u64 cur_offset;
-	int rc;
-
-	if (len == 0 || len & (LLOG_CHUNK_SIZE - 1))
-		return -EINVAL;
-
-	CDEBUG(D_OTHER, "looking for log index %u\n", prev_idx);
-
-	cur_offset = LLOG_CHUNK_SIZE;
-	llog_skip_over(&cur_offset, 0, prev_idx);
-
-	while (cur_offset < i_size_read(loghandle->lgh_file->f_dentry->d_inode)) {
-		struct llog_rec_hdr *rec, *last_rec;
-		struct llog_rec_tail *tail;
-		loff_t ppos = cur_offset;
-
-		rc = fsfilt_read_record(loghandle->lgh_ctxt->loc_exp->exp_obd,
-					loghandle->lgh_file, buf, len,
-					&cur_offset);
-		if (rc < 0) {
-			CERROR("Cant read llog block at log id "DOSTID
-			       "/%u offset "LPU64"\n",
-			       POSTID(&loghandle->lgh_id.lgl_oi),
-			       loghandle->lgh_id.lgl_ogen,
-			       cur_offset);
-			return rc;
-		}
-
-		/* put number of bytes read into rc to make code simpler */
-		rc = cur_offset - ppos;
-
-		if (rc == 0) /* end of file, nothing to do */
-			return 0;
-
-		if (rc < sizeof(*tail)) {
-			CERROR("Invalid llog block at log id "DOSTID"/%u offset"
-			       LPU64"\n", POSTID(&loghandle->lgh_id.lgl_oi),
-			       loghandle->lgh_id.lgl_ogen, cur_offset);
-			return -EINVAL;
-		}
-
-		rec = buf;
-		if (LLOG_REC_HDR_NEEDS_SWABBING(rec))
-			lustre_swab_llog_rec(rec);
-
-		tail = (struct llog_rec_tail *)(buf + rc -
-						sizeof(struct llog_rec_tail));
-
-		/* get the last record in block */
-		last_rec = (struct llog_rec_hdr *)(buf + rc -
-						   le32_to_cpu(tail->lrt_len));
-
-		if (LLOG_REC_HDR_NEEDS_SWABBING(last_rec))
-			lustre_swab_llog_rec(last_rec);
-		LASSERT(last_rec->lrh_index == tail->lrt_index);
-
-		/* this shouldn't happen */
-		if (tail->lrt_index == 0) {
-			CERROR("Invalid llog tail at log id "DOSTID"/%u offset"
-			       LPU64"\n", POSTID(&loghandle->lgh_id.lgl_oi),
-			       loghandle->lgh_id.lgl_ogen, cur_offset);
-			return -EINVAL;
-		}
-		if (tail->lrt_index < prev_idx)
-			continue;
-
-		/* sanity check that the start of the new buffer is no farther
-		 * than the record that we wanted.  This shouldn't happen. */
-		if (rec->lrh_index > prev_idx) {
-			CERROR("missed desired record? %u > %u\n",
-			       rec->lrh_index, prev_idx);
-			return -ENOENT;
-		}
-		return 0;
-	}
-	return -EIO;
-}
-
-static struct file *llog_filp_open(char *dir, char *name, int flags, int mode)
-{
-	char *logname;
-	struct file *filp;
-	int len;
-
-	OBD_ALLOC(logname, PATH_MAX);
-	if (logname == NULL)
-		return ERR_PTR(-ENOMEM);
-
-	len = snprintf(logname, PATH_MAX, "%s/%s", dir, name);
-	if (len >= PATH_MAX - 1) {
-		filp = ERR_PTR(-ENAMETOOLONG);
-	} else {
-		filp = l_filp_open(logname, flags, mode);
-		if (IS_ERR(filp) && PTR_ERR(filp) != -ENOENT)
-			CERROR("logfile creation %s: %ld\n", logname,
-			       PTR_ERR(filp));
-	}
-	OBD_FREE(logname, PATH_MAX);
-	return filp;
-}
-
-static int llog_lvfs_open(const struct lu_env *env,  struct llog_handle *handle,
-			  struct llog_logid *logid, char *name,
-			  enum llog_open_param open_param)
-{
-	struct llog_ctxt	*ctxt = handle->lgh_ctxt;
-	struct l_dentry		*dchild = NULL;
-	struct obd_device	*obd;
-	int			 rc = 0;
-
-	LASSERT(ctxt);
-	LASSERT(ctxt->loc_exp);
-	LASSERT(ctxt->loc_exp->exp_obd);
-	obd = ctxt->loc_exp->exp_obd;
-
-	LASSERT(handle);
-	if (logid != NULL) {
-		dchild = obd_lvfs_fid2dentry(ctxt->loc_exp, &logid->lgl_oi,
-					     logid->lgl_ogen);
-		if (IS_ERR(dchild)) {
-			rc = PTR_ERR(dchild);
-			CERROR("%s: error looking up logfile #"DOSTID "#%08x:"
-			       " rc = %d\n", ctxt->loc_obd->obd_name,
-			       POSTID(&logid->lgl_oi), logid->lgl_ogen, rc);
-			GOTO(out, rc);
-		}
-		if (dchild->d_inode == NULL) {
-			l_dput(dchild);
-			rc = -ENOENT;
-			CERROR("%s: nonexistent llog #"DOSTID"#%08x:"
-			       "rc = %d\n", ctxt->loc_obd->obd_name,
-			       POSTID(&logid->lgl_oi), logid->lgl_ogen, rc);
-			GOTO(out, rc);
-		}
-		handle->lgh_file = l_dentry_open(&obd->obd_lvfs_ctxt, dchild,
-						 O_RDWR | O_LARGEFILE);
-		l_dput(dchild);
-		if (IS_ERR(handle->lgh_file)) {
-			rc = PTR_ERR(handle->lgh_file);
-			handle->lgh_file = NULL;
-			CERROR("%s: error opening llog #"DOSTID"#%08x:"
-			       "rc = %d\n", ctxt->loc_obd->obd_name,
-			       POSTID(&logid->lgl_oi), logid->lgl_ogen, rc);
-			GOTO(out, rc);
-		}
-		handle->lgh_id = *logid;
-	} else if (name) {
-		handle->lgh_file = llog_filp_open(MOUNT_CONFIGS_DIR, name,
-						  O_RDWR | O_LARGEFILE, 0644);
-		if (IS_ERR(handle->lgh_file)) {
-			rc = PTR_ERR(handle->lgh_file);
-			handle->lgh_file = NULL;
-			if (rc == -ENOENT && open_param == LLOG_OPEN_NEW) {
-				OBD_ALLOC(handle->lgh_name, strlen(name) + 1);
-				if (handle->lgh_name)
-					strcpy(handle->lgh_name, name);
-				else
-					GOTO(out, rc = -ENOMEM);
-				rc = 0;
-			} else {
-				GOTO(out, rc);
-			}
-		} else {
-			lustre_build_llog_lvfs_oid(&handle->lgh_id,
-			    handle->lgh_file->f_dentry->d_inode->i_ino,
-			    handle->lgh_file->f_dentry->d_inode->i_generation);
-		}
-	} else {
-		LASSERTF(open_param == LLOG_OPEN_NEW, "%#x\n", open_param);
-		handle->lgh_file = NULL;
-	}
-
-	/* No new llog is expected but doesn't exist */
-	if (open_param != LLOG_OPEN_NEW && handle->lgh_file == NULL)
-		GOTO(out_name, rc = -ENOENT);
-
-	return 0;
-out_name:
-	if (handle->lgh_name != NULL)
-		OBD_FREE(handle->lgh_name, strlen(name) + 1);
-out:
-	return rc;
-}
-
-static int llog_lvfs_exist(struct llog_handle *handle)
-{
-	return (handle->lgh_file != NULL);
-}
-
-/* This is a callback from the llog_* functions.
- * Assumes caller has already pushed us into the kernel context. */
-static int llog_lvfs_create(const struct lu_env *env,
-			    struct llog_handle *handle,
-			    struct thandle *th)
-{
-	struct llog_ctxt	*ctxt = handle->lgh_ctxt;
-	struct obd_device	*obd;
-	struct l_dentry		*dchild = NULL;
-	struct file		*file;
-	struct obdo		*oa = NULL;
-	int			 rc = 0;
-	int			 open_flags = O_RDWR | O_CREAT | O_LARGEFILE;
-
-	LASSERT(ctxt);
-	LASSERT(ctxt->loc_exp);
-	obd = ctxt->loc_exp->exp_obd;
-	LASSERT(handle->lgh_file == NULL);
-
-	if (handle->lgh_name) {
-		file = llog_filp_open(MOUNT_CONFIGS_DIR, handle->lgh_name,
-				      open_flags, 0644);
-		if (IS_ERR(file))
-			return PTR_ERR(file);
-
-		lustre_build_llog_lvfs_oid(&handle->lgh_id,
-				file->f_dentry->d_inode->i_ino,
-				file->f_dentry->d_inode->i_generation);
-		handle->lgh_file = file;
-	} else {
-		OBDO_ALLOC(oa);
-		if (oa == NULL)
-			return -ENOMEM;
-
-		ostid_set_seq_llog(&oa->o_oi);
-		oa->o_valid = OBD_MD_FLGENER | OBD_MD_FLGROUP;
-
-		rc = obd_create(NULL, ctxt->loc_exp, oa, NULL, NULL);
-		if (rc)
-			GOTO(out, rc);
-
-		/* FIXME: rationalize the misuse of o_generation in
-		 *	this API along with mds_obd_{create,destroy}.
-		 *	Hopefully it is only an internal API issue. */
-#define o_generation o_parent_oid
-		dchild = obd_lvfs_fid2dentry(ctxt->loc_exp, &oa->o_oi,
-					     oa->o_generation);
-		if (IS_ERR(dchild))
-			GOTO(out, rc = PTR_ERR(dchild));
-
-		file = l_dentry_open(&obd->obd_lvfs_ctxt, dchild, open_flags);
-		l_dput(dchild);
-		if (IS_ERR(file))
-			GOTO(out, rc = PTR_ERR(file));
-		handle->lgh_id.lgl_oi = oa->o_oi;
-		handle->lgh_id.lgl_ogen = oa->o_generation;
-		handle->lgh_file = file;
-out:
-		OBDO_FREE(oa);
-	}
-	return rc;
-}
-
-static int llog_lvfs_close(const struct lu_env *env,
-			   struct llog_handle *handle)
-{
-	int rc;
-
-	if (handle->lgh_file == NULL)
-		return 0;
-	rc = filp_close(handle->lgh_file, 0);
-	if (rc)
-		CERROR("%s: error closing llog #"DOSTID"#%08x: "
-		       "rc = %d\n", handle->lgh_ctxt->loc_obd->obd_name,
-		       POSTID(&handle->lgh_id.lgl_oi),
-		       handle->lgh_id.lgl_ogen, rc);
-	handle->lgh_file = NULL;
-	if (handle->lgh_name) {
-		OBD_FREE(handle->lgh_name, strlen(handle->lgh_name) + 1);
-		handle->lgh_name = NULL;
-	}
-	return rc;
-}
-
-static int llog_lvfs_destroy(const struct lu_env *env,
-			     struct llog_handle *handle)
-{
-	struct dentry *fdentry;
-	struct obdo *oa;
-	struct obd_device *obd = handle->lgh_ctxt->loc_exp->exp_obd;
-	char *dir;
-	void *th;
-	struct inode *inode;
-	int rc, rc1;
-
-	dir = MOUNT_CONFIGS_DIR;
-
-	LASSERT(handle->lgh_file);
-	fdentry = handle->lgh_file->f_dentry;
-	inode = fdentry->d_parent->d_inode;
-	if (strcmp(fdentry->d_parent->d_name.name, dir) == 0) {
-		struct lvfs_run_ctxt saved;
-		struct vfsmount *mnt = mntget(handle->lgh_file->f_vfsmnt);
-
-		push_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL);
-		dget(fdentry);
-		rc = llog_lvfs_close(env, handle);
-		if (rc == 0) {
-			mutex_lock_nested(&inode->i_mutex, I_MUTEX_PARENT);
-			rc = ll_vfs_unlink(inode, fdentry, mnt);
-			mutex_unlock(&inode->i_mutex);
-		}
-		mntput(mnt);
-
-		dput(fdentry);
-		pop_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL);
-		return rc;
-	}
-
-	OBDO_ALLOC(oa);
-	if (oa == NULL)
-		return -ENOMEM;
-
-	oa->o_oi = handle->lgh_id.lgl_oi;
-	oa->o_generation = handle->lgh_id.lgl_ogen;
-#undef o_generation
-	oa->o_valid = OBD_MD_FLID | OBD_MD_FLGROUP | OBD_MD_FLGENER;
-
-	rc = llog_lvfs_close(env, handle);
-	if (rc)
-		GOTO(out, rc);
-
-	th = fsfilt_start_log(obd, inode, FSFILT_OP_UNLINK, NULL, 1);
-	if (IS_ERR(th)) {
-		CERROR("fsfilt_start failed: %ld\n", PTR_ERR(th));
-		GOTO(out, rc = PTR_ERR(th));
-	}
-
-	rc = obd_destroy(NULL, handle->lgh_ctxt->loc_exp, oa,
-			 NULL, NULL, NULL, NULL);
-
-	rc1 = fsfilt_commit(obd, inode, th, 0);
-	if (rc == 0 && rc1 != 0)
-		rc = rc1;
- out:
-	OBDO_FREE(oa);
-	return rc;
-}
-
-static int llog_lvfs_declare_create(const struct lu_env *env,
-				    struct llog_handle *res,
-				    struct thandle *th)
-{
-	return 0;
-}
-
-static int llog_lvfs_declare_write_rec(const struct lu_env *env,
-				       struct llog_handle *loghandle,
-				       struct llog_rec_hdr *rec,
-				       int idx, struct thandle *th)
-{
-	return 0;
-}
-
-struct llog_operations llog_lvfs_ops = {
-	.lop_write_rec		= llog_lvfs_write_rec,
-	.lop_next_block		= llog_lvfs_next_block,
-	.lop_prev_block		= llog_lvfs_prev_block,
-	.lop_read_header	= llog_lvfs_read_header,
-	.lop_create		= llog_lvfs_create,
-	.lop_destroy		= llog_lvfs_destroy,
-	.lop_close		= llog_lvfs_close,
-	.lop_open		= llog_lvfs_open,
-	.lop_exist		= llog_lvfs_exist,
-	.lop_declare_create	= llog_lvfs_declare_create,
-	.lop_declare_write_rec	= llog_lvfs_declare_write_rec,
-};
-EXPORT_SYMBOL(llog_lvfs_ops);
-#else /* !__KERNEL__ */
-struct llog_operations llog_lvfs_ops = {};
-#endif
-- 
1.7.9.5


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

* [PATCH 17/39] staging/lustre/llite: reset writeback index in ll_writepages
  2013-11-14 16:32 [PATCH 00/39] staging/lustre: patch bomb 2 Peng Tao
                   ` (15 preceding siblings ...)
  2013-11-14 16:32 ` [PATCH 16/39] staging/lustre/lvfs: remove llog_lvfs.c and other lvfs code from llog Peng Tao
@ 2013-11-14 16:32 ` Peng Tao
  2013-11-14 16:32 ` [PATCH 18/39] staging/lustre/llite: Delaying creation of client side proc entries Peng Tao
                   ` (21 subsequent siblings)
  38 siblings, 0 replies; 42+ messages in thread
From: Peng Tao @ 2013-11-14 16:32 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-kernel, Jinshan Xiong, Peng Tao, Andreas Dilger

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.

Lustre-change: http://review.whamcloud.com/6554
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3416
Signed-off-by: Jinshan Xiong <jinshan.xiong@intel.com>
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: Peng Tao <bergwolf@gmail.com>
Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
---
 drivers/staging/lustre/lustre/llite/rw.c      |    5 ++--
 drivers/staging/lustre/lustre/osc/osc_cache.c |   32 +++++++++++++++++--------
 2 files changed, 25 insertions(+), 12 deletions(-)

diff --git a/drivers/staging/lustre/lustre/llite/rw.c b/drivers/staging/lustre/lustre/llite/rw.c
index 112368f..9fe12d3 100644
--- a/drivers/staging/lustre/lustre/llite/rw.c
+++ b/drivers/staging/lustre/lustre/llite/rw.c
@@ -1262,8 +1262,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 00295da..7d63a37 100644
--- a/drivers/staging/lustre/lustre/osc/osc_cache.c
+++ b/drivers/staging/lustre/lustre/osc/osc_cache.c
@@ -1296,15 +1296,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 */
@@ -1441,7 +1445,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)
@@ -1485,10 +1489,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);
 
 	client_obd_list_lock(&cli->cl_loi_list_lock);
 
@@ -1526,8 +1531,15 @@ static int osc_enter_cache(const struct lu_env *env, struct client_obd *cli,
 
 		client_obd_list_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, rc);
 		}
@@ -1542,7 +1554,7 @@ static int osc_enter_cache(const struct lu_env *env, struct client_obd *cli,
 	}
 out:
 	client_obd_list_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;
 }
 
@@ -2868,7 +2880,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.9.5


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

* [PATCH 18/39] staging/lustre/llite: Delaying creation of client side proc entries.
  2013-11-14 16:32 [PATCH 00/39] staging/lustre: patch bomb 2 Peng Tao
                   ` (16 preceding siblings ...)
  2013-11-14 16:32 ` [PATCH 17/39] staging/lustre/llite: reset writeback index in ll_writepages Peng Tao
@ 2013-11-14 16:32 ` Peng Tao
  2013-11-14 16:32 ` [PATCH 19/39] staging/lustre/libcfs: Add relocation function to libcfs heap Peng Tao
                   ` (20 subsequent siblings)
  38 siblings, 0 replies; 42+ messages in thread
From: Peng Tao @ 2013-11-14 16:32 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-kernel, Gaurav Mahajan, Peng Tao, Andreas Dilger

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.

Lustre-change: http://review.whamcloud.com/6852
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-2941
Signed-off-by: Gaurav Mahajan <gmahajan@ddn.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Reviewed-by: Emoly Liu <emoly.liu@intel.com>
Signed-off-by: Peng Tao <bergwolf@gmail.com>
Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
---
 drivers/staging/lustre/lustre/llite/llite_lib.c |   17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/drivers/staging/lustre/lustre/llite/llite_lib.c b/drivers/staging/lustre/lustre/llite/llite_lib.c
index 18e3db2..a64808c 100644
--- a/drivers/staging/lustre/lustre/llite/llite_lib.c
+++ b/drivers/staging/lustre/lustre/llite/llite_lib.c
@@ -186,13 +186,6 @@ static int client_common_fill_super(struct super_block *sb, char *md, char *dt,
 		return -ENOMEM;
 	}
 
-	if (proc_lustre_fs_root) {
-		err = lprocfs_register_mountpoint(proc_lustre_fs_root, sb,
-						  dt, md);
-		if (err < 0)
-			CERROR("could not register mount in /proc/fs/lustre\n");
-	}
-
 	/* indicate the features supported by this client */
 	data->ocd_connect_flags = OBD_CONNECT_IBITS    | OBD_CONNECT_NODEVOH  |
 				  OBD_CONNECT_ATTRFID  |
@@ -590,6 +583,15 @@ static int client_common_fill_super(struct super_block *sb, char *md, char *dt,
 		OBD_FREE_PTR(data);
 	if (osfs != NULL)
 		OBD_FREE_PTR(osfs);
+	if (proc_lustre_fs_root != NULL) {
+		err = lprocfs_register_mountpoint(proc_lustre_fs_root, sb,
+						  dt, md);
+		if (err < 0) {
+			CERROR("%s: could not register mount in lprocfs: "
+			       "rc = %d\n", ll_get_fsname(sb, NULL, 0), err);
+			err = 0;
+		}
+	}
 
 	return err;
 out_root:
@@ -612,7 +614,6 @@ out:
 		OBD_FREE_PTR(data);
 	if (osfs != NULL)
 		OBD_FREE_PTR(osfs);
-	lprocfs_unregister_mountpoint(sbi);
 	return err;
 }
 
-- 
1.7.9.5


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

* [PATCH 19/39] staging/lustre/libcfs: Add relocation function to libcfs heap
  2013-11-14 16:32 [PATCH 00/39] staging/lustre: patch bomb 2 Peng Tao
                   ` (17 preceding siblings ...)
  2013-11-14 16:32 ` [PATCH 18/39] staging/lustre/llite: Delaying creation of client side proc entries Peng Tao
@ 2013-11-14 16:32 ` Peng Tao
  2013-11-14 16:32 ` [PATCH 20/39] staging/lustre/build: fix 'data race condition' issues Peng Tao
                   ` (19 subsequent siblings)
  38 siblings, 0 replies; 42+ messages in thread
From: Peng Tao @ 2013-11-14 16:32 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-kernel, Li Xi, Peng Tao, Andreas Dilger

From: Li Xi <lixi@ddn.com>

When changing the values of the node in the heap which might affect
its ranking, we have to remove the node from the heap, change the
values and then insert the node into the heap again. The process of
inserting into the heap might fail because of memory insufficiency.
Sometimes, it is not convienient and efficient for a caller to handle
such kind of failure.

This patch adds a new function to do the job.

Lustre-change: http://review.whamcloud.com/6743
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3494
Signed-off-by: Li Xi <lixi@ddn.com>
Reviewed-by: Bobbie Lind <bobbie.j.lind@intel.com>
Reviewed-by: Liang Zhen <liang.zhen@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: Peng Tao <bergwolf@gmail.com>
Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
---
 .../lustre/include/linux/libcfs/libcfs_heap.h      |    1 +
 drivers/staging/lustre/lustre/libcfs/heap.c        |   18 ++++++++++++++++--
 2 files changed, 17 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/lustre/include/linux/libcfs/libcfs_heap.h b/drivers/staging/lustre/include/linux/libcfs/libcfs_heap.h
index bfa6d7b..9d72647 100644
--- a/drivers/staging/lustre/include/linux/libcfs/libcfs_heap.h
+++ b/drivers/staging/lustre/include/linux/libcfs/libcfs_heap.h
@@ -166,6 +166,7 @@ cfs_binheap_t *cfs_binheap_create(cfs_binheap_ops_t *ops, unsigned int flags,
 cfs_binheap_node_t *cfs_binheap_find(cfs_binheap_t *h, unsigned int idx);
 int cfs_binheap_insert(cfs_binheap_t *h, cfs_binheap_node_t *e);
 void cfs_binheap_remove(cfs_binheap_t *h, cfs_binheap_node_t *e);
+void cfs_binheap_relocate(cfs_binheap_t *h, cfs_binheap_node_t *e);
 
 static inline int
 cfs_binheap_size(cfs_binheap_t *h)
diff --git a/drivers/staging/lustre/lustre/libcfs/heap.c b/drivers/staging/lustre/lustre/libcfs/heap.c
index 147e4fe..2493582 100644
--- a/drivers/staging/lustre/lustre/libcfs/heap.c
+++ b/drivers/staging/lustre/lustre/libcfs/heap.c
@@ -463,8 +463,7 @@ cfs_binheap_remove(cfs_binheap_t *h, cfs_binheap_node_t *e)
 
 	last->chn_index = cur_idx;
 	*cur_ptr = last;
-	if (!cfs_binheap_bubble(h, *cur_ptr))
-		cfs_binheap_sink(h, *cur_ptr);
+	cfs_binheap_relocate(h, *cur_ptr);
 
 	e->chn_index = CBH_POISON;
 	if (h->cbh_ops->hop_exit)
@@ -472,4 +471,19 @@ cfs_binheap_remove(cfs_binheap_t *h, cfs_binheap_node_t *e)
 }
 EXPORT_SYMBOL(cfs_binheap_remove);
 
+/**
+ * Relocate a node in the binary heap.
+ * Should be called whenever a node's values
+ * which affects its ranking are changed.
+ *
+ * \param[in] h The heap
+ * \param[in] e The node
+ */
+void
+cfs_binheap_relocate(cfs_binheap_t *h, cfs_binheap_node_t *e)
+{
+	if (!cfs_binheap_bubble(h, e))
+		cfs_binheap_sink(h, e);
+}
+EXPORT_SYMBOL(cfs_binheap_relocate);
 /** @} heap */
-- 
1.7.9.5


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

* [PATCH 20/39] staging/lustre/build: fix 'data race condition' issues
  2013-11-14 16:32 [PATCH 00/39] staging/lustre: patch bomb 2 Peng Tao
                   ` (18 preceding siblings ...)
  2013-11-14 16:32 ` [PATCH 19/39] staging/lustre/libcfs: Add relocation function to libcfs heap Peng Tao
@ 2013-11-14 16:32 ` Peng Tao
  2013-11-14 16:32 ` [PATCH 21/39] staging/lustre/autoconf: remove LC_LOCK_MAP_ACQUIRE test Peng Tao
                   ` (18 subsequent siblings)
  38 siblings, 0 replies; 42+ messages in thread
From: Peng Tao @ 2013-11-14 16:32 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: linux-kernel, Sebastien Buisson, Peng Tao, Andreas Dilger

From: Sebastien Buisson <sebastien.buisson@bull.net>

Fix 'data race condition' defects found by Coverity version
6.5.0:
Data race condition (MISSING_LOCK)
Accessing variable without holding lock. Elsewhere,
this variable is accessed with lock held.

Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-2744
Lustre-change: http://review.whamcloud.com/6567
Signed-off-by: Sebastien Buisson <sebastien.buisson@bull.net>
Reviewed-by: Liang Zhen <liang.zhen@intel.com>
Reviewed-by: Dmitry Eremin <dmitry.eremin@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: Peng Tao <bergwolf@gmail.com>
Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
---
 drivers/staging/lustre/lnet/selftest/conrpc.c |    8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/lustre/lnet/selftest/conrpc.c b/drivers/staging/lustre/lnet/selftest/conrpc.c
index 4d48c77..d600823 100644
--- a/drivers/staging/lustre/lnet/selftest/conrpc.c
+++ b/drivers/staging/lustre/lnet/selftest/conrpc.c
@@ -938,8 +938,12 @@ lstcon_sesnew_stat_reply(lstcon_rpc_trans_t *trans,
 		return status;
 
 	if (!trans->tas_feats_updated) {
-		trans->tas_feats_updated = 1;
-		trans->tas_features = reply->msg_ses_feats;
+		spin_lock(&console_session.ses_rpc_lock);
+		if (!trans->tas_feats_updated) { /* recheck with lock */
+			trans->tas_feats_updated = 1;
+			trans->tas_features = reply->msg_ses_feats;
+		}
+		spin_unlock(&console_session.ses_rpc_lock);
 	}
 
 	if (reply->msg_ses_feats != trans->tas_features) {
-- 
1.7.9.5


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

* [PATCH 21/39] staging/lustre/autoconf: remove LC_LOCK_MAP_ACQUIRE test
  2013-11-14 16:32 [PATCH 00/39] staging/lustre: patch bomb 2 Peng Tao
                   ` (19 preceding siblings ...)
  2013-11-14 16:32 ` [PATCH 20/39] staging/lustre/build: fix 'data race condition' issues Peng Tao
@ 2013-11-14 16:32 ` Peng Tao
  2013-11-14 16:32 ` [PATCH 22/39] staging/lustre/mdc: document mdc_rpc_lock Peng Tao
                   ` (17 subsequent siblings)
  38 siblings, 0 replies; 42+ messages in thread
From: Peng Tao @ 2013-11-14 16:32 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: linux-kernel, James Simmons, Jeff Mahoney, Peng Tao, Andreas Dilger

From: James Simmons <uja.ornl@gmail.com>

lock_map_acquire has been in the upstream kernel since v2.6.27.
We can remove the test and dead code.

Lustre-change: http://review.whamcloud.com/5369
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-2800
Signed-off-by: Jeff Mahoney <jeffm@suse.com>
Signed-off-by: James Simmons <uja.ornl@gmail.com>
Reviewed-by: Bob Glossman <bob.glossman@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: Peng Tao <bergwolf@gmail.com>
Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
---
 drivers/staging/lustre/lustre/obdclass/cl_lock.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/lustre/lustre/obdclass/cl_lock.c b/drivers/staging/lustre/lustre/obdclass/cl_lock.c
index 749eb08..828d492 100644
--- a/drivers/staging/lustre/lustre/obdclass/cl_lock.c
+++ b/drivers/staging/lustre/lustre/obdclass/cl_lock.c
@@ -162,7 +162,7 @@ static void cl_lock_lockdep_release(const struct lu_env *env,
 				    struct cl_lock *lock)
 {
 	cl_lock_counters(env, lock)->ctc_nr_locks_acquired--;
-	lock_release(&lock->dep_map, 0, RETIP);
+	lock_map_release(&lock->dep_map);
 }
 
 #else /* !CONFIG_LOCKDEP */
-- 
1.7.9.5


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

* [PATCH 22/39] staging/lustre/mdc: document mdc_rpc_lock
  2013-11-14 16:32 [PATCH 00/39] staging/lustre: patch bomb 2 Peng Tao
                   ` (20 preceding siblings ...)
  2013-11-14 16:32 ` [PATCH 21/39] staging/lustre/autoconf: remove LC_LOCK_MAP_ACQUIRE test Peng Tao
@ 2013-11-14 16:32 ` Peng Tao
  2013-11-14 16:32 ` [PATCH 23/39] staging/lustre/autoconf: remove LC_FS_STRUCT_USE_PATH Peng Tao
                   ` (16 subsequent siblings)
  38 siblings, 0 replies; 42+ messages in thread
From: Peng Tao @ 2013-11-14 16:32 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-kernel, Ned Bass, Peng Tao, Andreas Dilger

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.

Lustre-change: http://review.whamcloud.com/6593
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3443
Signed-off-by: Ned Bass <bass6@llnl.gov>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Reviewed-by: Keith Mannthey <keith.mannthey@intel.com>
Signed-off-by: Peng Tao <bergwolf@gmail.com>
Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
---
 drivers/staging/lustre/lustre/include/lustre_mdc.h |   18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/drivers/staging/lustre/lustre/include/lustre_mdc.h b/drivers/staging/lustre/lustre/include/lustre_mdc.h
index 1900025..3bb2f83 100644
--- a/drivers/staging/lustre/lustre/include/lustre_mdc.h
+++ b/drivers/staging/lustre/lustre/include/lustre_mdc.h
@@ -67,9 +67,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.9.5


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

* [PATCH 23/39] staging/lustre/autoconf: remove LC_FS_STRUCT_USE_PATH
  2013-11-14 16:32 [PATCH 00/39] staging/lustre: patch bomb 2 Peng Tao
                   ` (21 preceding siblings ...)
  2013-11-14 16:32 ` [PATCH 22/39] staging/lustre/mdc: document mdc_rpc_lock Peng Tao
@ 2013-11-14 16:32 ` Peng Tao
  2013-11-14 16:32 ` [PATCH 24/39] staging/lustre/obdclass: fix wrong device put in case of race Peng Tao
                   ` (15 subsequent siblings)
  38 siblings, 0 replies; 42+ messages in thread
From: Peng Tao @ 2013-11-14 16:32 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: linux-kernel, James Simmons, Jeff Mahoney, Peng Tao, Andreas Dilger

From: James Simmons <uja.ornl@gmail.com>

struct fs_struct has been using struct path for working dirs
since v2.6.26.

We can remove the test and the dead code.

Lustre-change: http://review.whamcloud.com/5359
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-2800
Signed-off-by: Jeff Mahoney <jeffm@suse.com>
Signed-off-by: James Simmons <uja.ornl@gmail.com>
Reviewed-by: Bob Glossman <bob.glossman@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: Peng Tao <bergwolf@gmail.com>
Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
---
 .../lustre/lustre/include/linux/lustre_compat25.h  |    5 -----
 drivers/staging/lustre/lustre/lvfs/lvfs_linux.c    |   14 +++++++-------
 drivers/staging/lustre/lustre/ptlrpc/sec_config.c  |    2 +-
 3 files changed, 8 insertions(+), 13 deletions(-)

diff --git a/drivers/staging/lustre/lustre/include/linux/lustre_compat25.h b/drivers/staging/lustre/lustre/include/linux/lustre_compat25.h
index 2e1b7f1..8e1505a 100644
--- a/drivers/staging/lustre/lustre/include/linux/lustre_compat25.h
+++ b/drivers/staging/lustre/lustre/include/linux/lustre_compat25.h
@@ -111,11 +111,6 @@ static inline void ll_set_fs_pwd(struct fs_struct *fs, struct vfsmount *mnt,
 #define cfs_bio_io_error(a,b)   bio_io_error((a))
 #define cfs_bio_endio(a,b,c)    bio_endio((a),(c))
 
-#define cfs_fs_pwd(fs)       ((fs)->pwd.dentry)
-#define cfs_fs_mnt(fs)       ((fs)->pwd.mnt)
-#define cfs_path_put(nd)     path_put(&(nd)->path)
-
-
 #ifndef SLAB_DESTROY_BY_RCU
 #define SLAB_DESTROY_BY_RCU 0
 #endif
diff --git a/drivers/staging/lustre/lustre/lvfs/lvfs_linux.c b/drivers/staging/lustre/lustre/lvfs/lvfs_linux.c
index 1ef06fe..86b09a8 100644
--- a/drivers/staging/lustre/lustre/lvfs/lvfs_linux.c
+++ b/drivers/staging/lustre/lustre/lvfs/lvfs_linux.c
@@ -119,10 +119,10 @@ void push_ctxt(struct lvfs_run_ctxt *save, struct lvfs_run_ctxt *new_ctx,
 	OBD_SET_CTXT_MAGIC(save);
 
 	save->fs = get_fs();
-	LASSERT(d_count(cfs_fs_pwd(current->fs)));
+	LASSERT(d_count(current->fs->pwd.dentry));
 	LASSERT(d_count(new_ctx->pwd));
-	save->pwd = dget(cfs_fs_pwd(current->fs));
-	save->pwdmnt = mntget(cfs_fs_mnt(current->fs));
+	save->pwd = dget(current->fs->pwd.dentry);
+	save->pwdmnt = mntget(current->fs->pwd.mnt);
 	save->luc.luc_umask = current_umask();
 	save->ngroups = current_cred()->group_info->ngroups;
 
@@ -170,10 +170,10 @@ void pop_ctxt(struct lvfs_run_ctxt *saved, struct lvfs_run_ctxt *new_ctx,
 	ASSERT_CTXT_MAGIC(saved->magic);
 	ASSERT_KERNEL_CTXT("popping non-kernel context!\n");
 
-	LASSERTF(cfs_fs_pwd(current->fs) == new_ctx->pwd, "%p != %p\n",
-		 cfs_fs_pwd(current->fs), new_ctx->pwd);
-	LASSERTF(cfs_fs_mnt(current->fs) == new_ctx->pwdmnt, "%p != %p\n",
-		 cfs_fs_mnt(current->fs), new_ctx->pwdmnt);
+	LASSERTF(current->fs->pwd.dentry == new_ctx->pwd, "%p != %p\n",
+		 current->fs->pwd.dentry, new_ctx->pwd);
+	LASSERTF(current->fs->pwd.mnt == new_ctx->pwdmnt, "%p != %p\n",
+		 current->fs->pwd.mnt, new_ctx->pwdmnt);
 
 	set_fs(saved->fs);
 	ll_set_fs_pwd(current->fs, saved->pwdmnt, saved->pwd);
diff --git a/drivers/staging/lustre/lustre/ptlrpc/sec_config.c b/drivers/staging/lustre/lustre/ptlrpc/sec_config.c
index 6cc3f23..6b4c971 100644
--- a/drivers/staging/lustre/lustre/ptlrpc/sec_config.c
+++ b/drivers/staging/lustre/lustre/ptlrpc/sec_config.c
@@ -1015,7 +1015,7 @@ int sptlrpc_target_local_copy_conf(struct obd_device *obd,
 
 	push_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL);
 
-	dentry = ll_lookup_one_len(MOUNT_CONFIGS_DIR, cfs_fs_pwd(current->fs),
+	dentry = ll_lookup_one_len(MOUNT_CONFIGS_DIR, current->fs->pwd.dentry,
 				   strlen(MOUNT_CONFIGS_DIR));
 	if (IS_ERR(dentry)) {
 		rc = PTR_ERR(dentry);
-- 
1.7.9.5


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

* [PATCH 24/39] staging/lustre/obdclass: fix wrong device put in case of race
  2013-11-14 16:32 [PATCH 00/39] staging/lustre: patch bomb 2 Peng Tao
                   ` (22 preceding siblings ...)
  2013-11-14 16:32 ` [PATCH 23/39] staging/lustre/autoconf: remove LC_FS_STRUCT_USE_PATH Peng Tao
@ 2013-11-14 16:32 ` Peng Tao
  2013-11-14 16:32 ` [PATCH 25/39] staging/lustre/lmv: choose right MDT for open by FID Peng Tao
                   ` (14 subsequent siblings)
  38 siblings, 0 replies; 42+ messages in thread
From: Peng Tao @ 2013-11-14 16:32 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: linux-kernel, Mikhail Pershin, Peng Tao, Andreas Dilger

From: Mikhail Pershin <mike.pershin@intel.com>

The ls_device_put() might be called from local_oid_storage_fini()
wrongly if mutex-protected check failed due to race

Lustre-change: http://review.whamcloud.com/6334
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3316
Signed-off-by: Mikhail Pershin <mike.pershin@intel.com>
Reviewed-by: Fan Yong <fan.yong@intel.com>
Reviewed-by: Alex Zhuravlev <alexey.zhuravlev@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: Peng Tao <bergwolf@gmail.com>
Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
---
 .../staging/lustre/lustre/obdclass/local_storage.c |   13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/lustre/lustre/obdclass/local_storage.c b/drivers/staging/lustre/lustre/obdclass/local_storage.c
index 295bb7c..367d3fd 100644
--- a/drivers/staging/lustre/lustre/obdclass/local_storage.c
+++ b/drivers/staging/lustre/lustre/obdclass/local_storage.c
@@ -882,12 +882,15 @@ void local_oid_storage_fini(const struct lu_env *env,
 	ls = dt2ls_dev(los->los_dev);
 
 	mutex_lock(&ls->ls_los_mutex);
-	if (atomic_read(&los->los_refcount) == 0) {
-		if (los->los_obj)
-			lu_object_put_nocache(env, &los->los_obj->do_lu);
-		list_del(&los->los_list);
-		OBD_FREE_PTR(los);
+	if (atomic_read(&los->los_refcount) > 0) {
+		mutex_unlock(&ls->ls_los_mutex);
+		return;
 	}
+
+	if (los->los_obj)
+		lu_object_put_nocache(env, &los->los_obj->do_lu);
+	list_del(&los->los_list);
+	OBD_FREE_PTR(los);
 	mutex_unlock(&ls->ls_los_mutex);
 	ls_device_put(env, ls);
 }
-- 
1.7.9.5


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

* [PATCH 25/39] staging/lustre/lmv: choose right MDT for open by FID
  2013-11-14 16:32 [PATCH 00/39] staging/lustre: patch bomb 2 Peng Tao
                   ` (23 preceding siblings ...)
  2013-11-14 16:32 ` [PATCH 24/39] staging/lustre/obdclass: fix wrong device put in case of race Peng Tao
@ 2013-11-14 16:32 ` Peng Tao
  2013-11-14 16:32 ` [PATCH 26/39] staging/lustre/osd: remove fld lookup during configuration Peng Tao
                   ` (13 subsequent siblings)
  38 siblings, 0 replies; 42+ messages in thread
From: Peng Tao @ 2013-11-14 16:32 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-kernel, wang di, Peng Tao, Andreas Dilger

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

If the open is by FID, LMV should locate MDT by the FID
of the file/directory, instead of its parent.

Lustre-change: http://review.whamcloud.com/7253
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3712
Signed-off-by: wang di <di.wang@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: Peng Tao <bergwolf@gmail.com>
Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
---
 drivers/staging/lustre/lustre/lmv/lmv_intent.c |    8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/lustre/lustre/lmv/lmv_intent.c b/drivers/staging/lustre/lustre/lmv/lmv_intent.c
index 511b3b4..9d25fc4 100644
--- a/drivers/staging/lustre/lustre/lmv/lmv_intent.c
+++ b/drivers/staging/lustre/lustre/lmv/lmv_intent.c
@@ -167,7 +167,13 @@ int lmv_intent_open(struct obd_export *exp, struct md_op_data *op_data,
 	struct mdt_body		*body;
 	int			rc;
 
-	tgt = lmv_locate_mds(lmv, op_data, &op_data->op_fid1);
+	/* Note: client might open with some random flags(sanity 33b), so we can
+	 * not make sure op_fid2 is being initialized with BY_FID flag */
+	if (it->it_flags & MDS_OPEN_BY_FID && fid_is_sane(&op_data->op_fid2))
+		tgt = lmv_locate_mds(lmv, op_data, &op_data->op_fid2);
+	else
+		tgt = lmv_locate_mds(lmv, op_data, &op_data->op_fid1);
+
 	if (IS_ERR(tgt))
 		return PTR_ERR(tgt);
 
-- 
1.7.9.5


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

* [PATCH 26/39] staging/lustre/osd: remove fld lookup during configuration
  2013-11-14 16:32 [PATCH 00/39] staging/lustre: patch bomb 2 Peng Tao
                   ` (24 preceding siblings ...)
  2013-11-14 16:32 ` [PATCH 25/39] staging/lustre/lmv: choose right MDT for open by FID Peng Tao
@ 2013-11-14 16:32 ` Peng Tao
  2013-11-14 16:32 ` [PATCH 27/39] staging/lustre/mdt: HSM EXIST event not triggered at last rm/mv Peng Tao
                   ` (12 subsequent siblings)
  38 siblings, 0 replies; 42+ messages in thread
From: Peng Tao @ 2013-11-14 16:32 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-kernel, wang di, Peng Tao, Andreas Dilger

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

Remove fld lookup during configuration, so to avoid accessing
FLDB on MDT0 before MDT0 is setup.

1. add od_is_ost to check whether the FID is on OST, instead
of lookup in FLDB.

2. add oic_device in OI cache, so in OI cache lookup, it will
try to match device to avoid the ino of agent inode is being
retrieved from OI cache. Then osd_remote_fid, which will trigger
fld lookup, can be removed from osd index lookup.

Lustre-change: http://review.whamcloud.com/7266
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3126
Signed-off-by: wang di <di.wang@intel.com>
Reviewed-by: Alex Zhuravlev <alexey.zhuravlev@intel.com>
Reviewed-by: Niu Yawei <yawei.niu@intel.com>
Reviewed-by: Mike Pershin <mike.pershin@intel.com>
Reviewed-by: John L. Hammond <john.hammond@intel.com>
Reviewed-by: Fan Yong <fan.yong@intel.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
[pick up only lustre_idl.h change -- Peng Tao]
Signed-off-by: Peng Tao <bergwolf@gmail.com>
Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
---
 .../lustre/lustre/include/lustre/lustre_idl.h      |    7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/lustre/lustre/include/lustre/lustre_idl.h b/drivers/staging/lustre/lustre/include/lustre/lustre_idl.h
index 7bdb24f..15f70dc 100644
--- a/drivers/staging/lustre/lustre/include/lustre/lustre_idl.h
+++ b/drivers/staging/lustre/lustre/include/lustre/lustre_idl.h
@@ -611,10 +611,15 @@ static inline obd_id fid_idif_id(obd_seq seq, __u32 oid, __u32 ver)
 	return ((__u64)ver << 48) | ((seq & 0xffff) << 32) | oid;
 }
 
+static inline __u32 idif_ost_idx(obd_seq seq)
+{
+	return (seq >> 16) & 0xffff;
+}
+
 /* extract ost index from IDIF FID */
 static inline __u32 fid_idif_ost_idx(const struct lu_fid *fid)
 {
-	return (fid_seq(fid) >> 16) & 0xffff;
+	return idif_ost_idx(fid_seq(fid));
 }
 
 /* extract OST sequence (group) from a wire ost_id (id/seq) pair */
-- 
1.7.9.5


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

* [PATCH 27/39] staging/lustre/mdt: HSM EXIST event not triggered at last rm/mv
  2013-11-14 16:32 [PATCH 00/39] staging/lustre: patch bomb 2 Peng Tao
                   ` (25 preceding siblings ...)
  2013-11-14 16:32 ` [PATCH 26/39] staging/lustre/osd: remove fld lookup during configuration Peng Tao
@ 2013-11-14 16:32 ` Peng Tao
  2013-11-14 16:32 ` [PATCH 28/39] staging/lustre/ldlm: ldlm_flock_deadlock() ASSERTION( req != lock ) failed Peng Tao
                   ` (11 subsequent siblings)
  38 siblings, 0 replies; 42+ messages in thread
From: Peng Tao @ 2013-11-14 16:32 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-kernel, JC Lafoucriere, Peng Tao, Andreas Dilger

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

After a rm or mv, if the target file is destroyed
(last unlink) and if there is an archive in the backend
a flags must be set in changelog event

Lustre-change: http://review.whamcloud.com/7260
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3718
Signed-off-by: JC Lafoucriere <jacques-charles.lafoucriere@cea.fr>
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>
[pick up only lustre_user.h change -- Peng Tao]
Signed-off-by: Peng Tao <bergwolf@gmail.com>
Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
---
 .../lustre/lustre/include/lustre/lustre_user.h     |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/lustre/lustre/include/lustre/lustre_user.h b/drivers/staging/lustre/lustre/include/lustre/lustre_user.h
index 2c72a88..0ad524a 100644
--- a/drivers/staging/lustre/lustre/include/lustre/lustre_user.h
+++ b/drivers/staging/lustre/lustre/include/lustre/lustre_user.h
@@ -692,7 +692,10 @@ 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.9.5


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

* [PATCH 28/39] staging/lustre/ldlm: ldlm_flock_deadlock() ASSERTION( req != lock ) failed
  2013-11-14 16:32 [PATCH 00/39] staging/lustre: patch bomb 2 Peng Tao
                   ` (26 preceding siblings ...)
  2013-11-14 16:32 ` [PATCH 27/39] staging/lustre/mdt: HSM EXIST event not triggered at last rm/mv Peng Tao
@ 2013-11-14 16:32 ` Peng Tao
  2013-11-14 16:32 ` [PATCH 29/39] staging/lustre/changelogs: Account for changelog_ext_rec in CR_MAXSIZE Peng Tao
                   ` (10 subsequent siblings)
  38 siblings, 0 replies; 42+ messages in thread
From: Peng Tao @ 2013-11-14 16:32 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-kernel, Andriy Skulysh, Peng Tao, Andreas Dilger

From: Andriy Skulysh <Andriy_Skulysh@xyratex.com>

Abort processing of flock blockers list
on reaching disconnected export

Lustre-change: http://review.whamcloud.com/7392
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3783
Signed-off-by: Andriy Skulysh <Andriy_Skulysh@xyratex.com>
Reviewed-by: Keith Mannthey <keith.mannthey@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: Peng Tao <bergwolf@gmail.com>
Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
---
 drivers/staging/lustre/lustre/ldlm/ldlm_flock.c |    3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_flock.c b/drivers/staging/lustre/lustre/ldlm/ldlm_flock.c
index 6324eff..d4598b6 100644
--- a/drivers/staging/lustre/lustre/ldlm/ldlm_flock.c
+++ b/drivers/staging/lustre/lustre/ldlm/ldlm_flock.c
@@ -195,6 +195,9 @@ ldlm_flock_deadlock(struct ldlm_lock *req, struct ldlm_lock *bl_lock)
 		cfs_hash_put(bl_exp->exp_flock_hash, &lock->l_exp_flock_hash);
 		bl_exp = bl_exp_new;
 
+		if (bl_exp->exp_failed)
+			break;
+
 		if (bl_owner == req_owner && bl_exp == req_exp) {
 			class_export_put(bl_exp);
 			return 1;
-- 
1.7.9.5


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

* [PATCH 29/39] staging/lustre/changelogs: Account for changelog_ext_rec in CR_MAXSIZE
  2013-11-14 16:32 [PATCH 00/39] staging/lustre: patch bomb 2 Peng Tao
                   ` (27 preceding siblings ...)
  2013-11-14 16:32 ` [PATCH 28/39] staging/lustre/ldlm: ldlm_flock_deadlock() ASSERTION( req != lock ) failed Peng Tao
@ 2013-11-14 16:32 ` Peng Tao
  2013-11-14 16:32 ` [PATCH 30/39] staging/lustre/build: build error with gcc 4.7.0 20110509 Peng Tao
                   ` (9 subsequent siblings)
  38 siblings, 0 replies; 42+ messages in thread
From: Peng Tao @ 2013-11-14 16:32 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: linux-kernel, Christopher J. Morrone, Peng Tao, Andreas Dilger

From: "Christopher J. Morrone" <morrone2@llnl.gov>

CR_MAXSIZE needs to account for an llog_changelog_rec that actually
contains a changelog_ext_rec structure rather than a changelog_rec.
With out doing so, a file size approaching the Linux kernel NAME_MAX
length that is renamed to a size also close to, or at, NAME_MAX will
exceed CR_MAXSIZE and trip an assertion.

Lustre-change: http://review.whamcloud.com/6993
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3587
Signed-off-by: Christopher J. Morrone <morrone2@llnl.gov>
Reviewed-by: Niu Yawei <yawei.niu@intel.com>
Reviewed-by: Lai Siyao <lai.siyao@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: Peng Tao <bergwolf@gmail.com>
Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
---
 .../lustre/lustre/include/lustre/lustre_user.h     |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/lustre/lustre/include/lustre/lustre_user.h b/drivers/staging/lustre/lustre/include/lustre/lustre_user.h
index 0ad524a..ffb56d7 100644
--- a/drivers/staging/lustre/lustre/include/lustre/lustre_user.h
+++ b/drivers/staging/lustre/lustre/include/lustre/lustre_user.h
@@ -766,7 +766,8 @@ static inline void hsm_set_cl_error(int *flags, int error)
 	*flags |= (error << CLF_HSM_ERR_L);
 }
 
-#define CR_MAXSIZE cfs_size_round(2*NAME_MAX + 1 + sizeof(struct changelog_rec))
+#define CR_MAXSIZE cfs_size_round(2*NAME_MAX + 1 + \
+				  sizeof(struct changelog_ext_rec))
 
 struct changelog_rec {
 	__u16		 cr_namelen;
-- 
1.7.9.5


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

* [PATCH 30/39] staging/lustre/build: build error with gcc 4.7.0 20110509
  2013-11-14 16:32 [PATCH 00/39] staging/lustre: patch bomb 2 Peng Tao
                   ` (28 preceding siblings ...)
  2013-11-14 16:32 ` [PATCH 29/39] staging/lustre/changelogs: Account for changelog_ext_rec in CR_MAXSIZE Peng Tao
@ 2013-11-14 16:32 ` Peng Tao
  2013-11-14 16:32 ` [PATCH 31/39] staging/lustre/build: fix 'NULL pointer dereference' errors Peng Tao
                   ` (8 subsequent siblings)
  38 siblings, 0 replies; 42+ messages in thread
From: Peng Tao @ 2013-11-14 16:32 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-kernel, Dmitry Eremin, Peng Tao, Andreas Dilger

From: Dmitry Eremin <dmitry.eremin@intel.com>

Fixed the error: 'tgt' and 'nf' may be used uninitialized in
this function. Also fixed comparison signed and unsigned
indexes.

Lustre-change: http://review.whamcloud.com/7382
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3775
Signed-off-by: Dmitry Eremin <dmitry.eremin@intel.com>
Reviewed-by: John L. Hammond <john.hammond@intel.com>
Reviewed-by: James Simmons <uja.ornl@gmail.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: Peng Tao <bergwolf@gmail.com>
Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
---
 drivers/staging/lustre/lustre/lmv/lmv_obd.c |   50 +++++++++++++++------------
 1 file changed, 27 insertions(+), 23 deletions(-)

diff --git a/drivers/staging/lustre/lustre/lmv/lmv_obd.c b/drivers/staging/lustre/lustre/lmv/lmv_obd.c
index 9d36014..2587f1a 100644
--- a/drivers/staging/lustre/lustre/lmv/lmv_obd.c
+++ b/drivers/staging/lustre/lustre/lmv/lmv_obd.c
@@ -257,9 +257,9 @@ static int lmv_connect(const struct lu_env *env,
 
 static void lmv_set_timeouts(struct obd_device *obd)
 {
-	struct lmv_tgt_desc   *tgt;
-	struct lmv_obd	*lmv;
-	int		    i;
+	struct lmv_tgt_desc	*tgt;
+	struct lmv_obd		*lmv;
+	__u32			 i;
 
 	lmv = &obd->u.lmv;
 	if (lmv->server_timeout == 0)
@@ -283,7 +283,7 @@ static int lmv_init_ea_size(struct obd_export *exp, int easize,
 {
 	struct obd_device   *obd = exp->exp_obd;
 	struct lmv_obd      *lmv = &obd->u.lmv;
-	int		  i;
+	__u32			 i;
 	int		  rc = 0;
 	int		  change = 0;
 
@@ -540,7 +540,7 @@ int lmv_check_connect(struct obd_device *obd)
 {
 	struct lmv_obd       *lmv = &obd->u.lmv;
 	struct lmv_tgt_desc  *tgt;
-	int		   i;
+	__u32			 i;
 	int		   rc;
 	int		   easize;
 
@@ -652,7 +652,7 @@ static int lmv_disconnect(struct obd_export *exp)
 	struct obd_device     *obd = class_exp2obd(exp);
 	struct lmv_obd	*lmv = &obd->u.lmv;
 	int		    rc;
-	int		    i;
+	__u32		    i;
 
 	if (!lmv->tgts)
 		goto out_local;
@@ -776,8 +776,9 @@ static int lmv_hsm_req_count(struct lmv_obd *lmv,
 			     const struct hsm_user_request *hur,
 			     const struct lmv_tgt_desc *tgt_mds)
 {
-	int			i, nr = 0;
-	struct lmv_tgt_desc    *curr_tgt;
+	__u32			 i;
+	int			 nr = 0;
+	struct lmv_tgt_desc	*curr_tgt;
 
 	/* count how many requests must be sent to the given target */
 	for (i = 0; i < hur->hur_request.hr_itemcount; i++) {
@@ -793,8 +794,8 @@ static void lmv_hsm_req_build(struct lmv_obd *lmv,
 			      const struct lmv_tgt_desc *tgt_mds,
 			      struct hsm_user_request *hur_out)
 {
-	int			i, nr_out;
-	struct lmv_tgt_desc    *curr_tgt;
+	__u32			 i, nr_out;
+	struct lmv_tgt_desc	*curr_tgt;
 
 	/* build the hsm_user_request for the given target */
 	hur_out->hur_request = hur_in->hur_request;
@@ -816,7 +817,8 @@ static void lmv_hsm_req_build(struct lmv_obd *lmv,
 static int lmv_hsm_ct_unregister(struct lmv_obd *lmv, unsigned int cmd, int len,
 				 struct lustre_kernelcomm *lk, void *uarg)
 {
-	int	i, rc = 0;
+	__u32	i;
+	int	rc;
 
 	/* unregister request (call from llapi_hsm_copytool_fini) */
 	for (i = 0; i < lmv->desc.ld_tgt_count; i++) {
@@ -837,8 +839,8 @@ static int lmv_hsm_ct_register(struct lmv_obd *lmv, unsigned int cmd, int len,
 			       struct lustre_kernelcomm *lk, void *uarg)
 {
 	struct file	*filp;
-	int		 i, j, err;
-	int		 rc = 0;
+	__u32		 i, j;
+	int		 err, rc;
 	bool		 any_set = false;
 
 	/* All or nothing: try to register to all MDS.
@@ -895,10 +897,10 @@ static int lmv_iocontrol(unsigned int cmd, struct obd_export *exp,
 {
 	struct obd_device    *obddev = class_exp2obd(exp);
 	struct lmv_obd       *lmv = &obddev->u.lmv;
-	int		   i = 0;
+	__u32		   i = 0;
 	int		   rc = 0;
 	int		   set = 0;
-	int		   count = lmv->desc.ld_tgt_count;
+	__u32		   count = lmv->desc.ld_tgt_count;
 
 	if (count == 0)
 		return -ENOTTY;
@@ -1414,7 +1416,7 @@ static int lmv_statfs(const struct lu_env *env, struct obd_export *exp,
 	struct lmv_obd	*lmv = &obd->u.lmv;
 	struct obd_statfs     *temp;
 	int		    rc = 0;
-	int		    i;
+	__u32		    i;
 
 	rc = lmv_check_connect(obd);
 	if (rc)
@@ -1584,7 +1586,7 @@ static int lmv_find_cbdata(struct obd_export *exp, const struct lu_fid *fid,
 {
 	struct obd_device   *obd = exp->exp_obd;
 	struct lmv_obd      *lmv = &obd->u.lmv;
-	int		  i;
+	__u32                i;
 	int		  rc;
 
 	rc = lmv_check_connect(obd);
@@ -2410,7 +2412,7 @@ int lmv_packmd(struct obd_export *exp, struct lov_mds_md **lmmp,
 	struct lmv_stripe_md      *meap;
 	struct lmv_stripe_md      *lsmp;
 	int			mea_size;
-	int			i;
+	__u32                      i;
 
 	mea_size = lmv_get_easize(lmv);
 	if (!lmmp)
@@ -2458,7 +2460,7 @@ int lmv_unpackmd(struct obd_export *exp, struct lov_stripe_md **lsmp,
 	struct lmv_stripe_md       *mea = (struct lmv_stripe_md *)lmm;
 	struct lmv_obd	     *lmv = &obd->u.lmv;
 	int			 mea_size;
-	int			 i;
+	__u32                       i;
 	__u32		       magic;
 
 	mea_size = lmv_get_easize(lmv);
@@ -2512,7 +2514,7 @@ static int lmv_cancel_unused(struct obd_export *exp, const struct lu_fid *fid,
 	struct lmv_obd	  *lmv = &obd->u.lmv;
 	int		      rc = 0;
 	int		      err;
-	int		      i;
+	__u32                    i;
 
 	LASSERT(fid != NULL);
 
@@ -2547,7 +2549,7 @@ ldlm_mode_t lmv_lock_match(struct obd_export *exp, __u64 flags,
 	struct obd_device       *obd = exp->exp_obd;
 	struct lmv_obd	  *lmv = &obd->u.lmv;
 	ldlm_mode_t	      rc;
-	int		      i;
+	__u32                    i;
 
 	CDEBUG(D_INODE, "Lock match for "DFID"\n", PFID(fid));
 
@@ -2723,7 +2725,8 @@ int lmv_quotactl(struct obd_device *unused, struct obd_export *exp,
 	struct obd_device   *obd = class_exp2obd(exp);
 	struct lmv_obd      *lmv = &obd->u.lmv;
 	struct lmv_tgt_desc *tgt = lmv->tgts[0];
-	int		  rc = 0, i;
+	int                  rc = 0;
+	__u32                i;
 	__u64		curspace, curinodes;
 
 	if (!lmv->desc.ld_tgt_count || !tgt->ltd_active) {
@@ -2770,7 +2773,8 @@ int lmv_quotacheck(struct obd_device *unused, struct obd_export *exp,
 	struct obd_device   *obd = class_exp2obd(exp);
 	struct lmv_obd      *lmv = &obd->u.lmv;
 	struct lmv_tgt_desc *tgt;
-	int		  i, rc = 0;
+	int		    rc = 0;
+	__u32		    i;
 
 	for (i = 0; i < lmv->desc.ld_tgt_count; i++) {
 		int err;
-- 
1.7.9.5


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

* [PATCH 31/39] staging/lustre/build: fix 'NULL pointer dereference' errors
  2013-11-14 16:32 [PATCH 00/39] staging/lustre: patch bomb 2 Peng Tao
                   ` (29 preceding siblings ...)
  2013-11-14 16:32 ` [PATCH 30/39] staging/lustre/build: build error with gcc 4.7.0 20110509 Peng Tao
@ 2013-11-14 16:32 ` Peng Tao
  2013-11-14 16:32 ` [PATCH 32/39] staging/lustre/clio: honor O_NOATIME Peng Tao
                   ` (7 subsequent siblings)
  38 siblings, 0 replies; 42+ messages in thread
From: Peng Tao @ 2013-11-14 16:32 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: linux-kernel, Sebastien Buisson, James Nunez, Peng Tao, Andreas Dilger

From: Sebastien Buisson <sebastien.buisson@bull.net>

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)

Lustre-change: http://review.whamcloud.com/5868
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3042
Signed-off-by: Sebastien Buisson <sebastien.buisson@bull.net>
Signed-off-by: James Nunez <james.a.nunez@intel.com>
Reviewed-by: Dmitry Eremin <dmitry.eremin@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: Peng Tao <bergwolf@gmail.com>
Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
---
 .../staging/lustre/lustre/include/lustre_update.h  |    3 ++-
 drivers/staging/lustre/lustre/llite/dir.c          |   17 ++++++++++++-----
 drivers/staging/lustre/lustre/lov/lov_io.c         |    3 ++-
 3 files changed, 16 insertions(+), 7 deletions(-)

diff --git a/drivers/staging/lustre/lustre/include/lustre_update.h b/drivers/staging/lustre/lustre/include/lustre_update.h
index 84defce..3f424af 100644
--- a/drivers/staging/lustre/lustre/include/lustre_update.h
+++ b/drivers/staging/lustre/lustre/include/lustre_update.h
@@ -165,12 +165,13 @@ static inline int update_get_reply_buf(struct update_reply *reply, void **buf,
 	int  result;
 
 	ptr = update_get_buf_internal(reply, index, &size);
+	LASSERT(ptr != NULL);
 	result = *(int *)ptr;
 
 	if (result < 0)
 		return result;
 
-	LASSERT((ptr != NULL && size >= sizeof(int)));
+	LASSERT(size >= sizeof(int));
 	*buf = ptr + sizeof(int);
 	return size - sizeof(int);
 }
diff --git a/drivers/staging/lustre/lustre/llite/dir.c b/drivers/staging/lustre/lustre/llite/dir.c
index f52c624..1856701 100644
--- a/drivers/staging/lustre/lustre/llite/dir.c
+++ b/drivers/staging/lustre/lustre/llite/dir.c
@@ -597,23 +597,30 @@ static int ll_readdir(struct file *filp, struct dir_context *ctx)
 	struct inode		*inode	= filp->f_dentry->d_inode;
 	struct ll_file_data	*lfd	= LUSTRE_FPRIVATE(filp);
 	struct ll_sb_info	*sbi	= ll_i2sbi(inode);
+	__u64			pos;
 	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 "
+	if (lfd != NULL)
+		pos = lfd->lfd_pos;
+	else
+		pos = 0;
+
+	CDEBUG(D_VFSTRACE, "VFS Op:inode=%lu/%u(%p) pos %llu/%llu "
 	       " 32bit_api %d\n", inode->i_ino, inode->i_generation,
-	       inode, (unsigned long)lfd->lfd_pos, i_size_read(inode), api32);
+	       inode, pos, i_size_read(inode), api32);
 
-	if (lfd->lfd_pos == MDS_DIR_END_OFF)
+	if (pos == MDS_DIR_END_OFF)
 		/*
 		 * end-of-file.
 		 */
 		GOTO(out, rc = 0);
 
-	ctx->pos = lfd->lfd_pos;
+	ctx->pos = pos;
 	rc = ll_dir_read(inode, ctx);
-	lfd->lfd_pos = ctx->pos;
+	if (lfd != NULL)
+		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 5a6ab70..cdd69232 100644
--- a/drivers/staging/lustre/lustre/lov/lov_io.c
+++ b/drivers/staging/lustre/lustre/lov/lov_io.c
@@ -272,10 +272,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 != NULL);
+	lsm = lio->lis_object->lo_lsm;
 
 	/*
 	 * Need to be optimized, we can't afford to allocate a piece of memory
-- 
1.7.9.5


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

* [PATCH 32/39] staging/lustre/clio: honor O_NOATIME
  2013-11-14 16:32 [PATCH 00/39] staging/lustre: patch bomb 2 Peng Tao
                   ` (30 preceding siblings ...)
  2013-11-14 16:32 ` [PATCH 31/39] staging/lustre/build: fix 'NULL pointer dereference' errors Peng Tao
@ 2013-11-14 16:32 ` Peng Tao
  2013-11-14 16:32 ` [PATCH 33/39] staging/lustre/llite: return compatible fsid for statfs Peng Tao
                   ` (6 subsequent siblings)
  38 siblings, 0 replies; 42+ messages in thread
From: Peng Tao @ 2013-11-14 16:32 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: linux-kernel, John L. Hammond, Peng Tao, Andreas Dilger

From: "John L. Hammond" <john.hammond@intel.com>

Add a ci_noatime bit to struct cl_io. In ll_io_init() set this bit if
O_NOATIME is set in f_flags. Ensure that this bit is propagated down
to lower layers. In osc_io_read_start() don't update atime if this bit
is set. Add sanity test 39n to check that passing O_NOATIME to open()
is honored.

Lustre-change: http://review.whamcloud.com/7442
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3832
Signed-off-by: John L. Hammond <john.hammond@intel.com>
Reviewed-by: Jinshan Xiong <jinshan.xiong@intel.com>
Reviewed-by: Lai Siyao <lai.siyao@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: Peng Tao <bergwolf@gmail.com>
Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
---
 drivers/staging/lustre/lustre/include/cl_object.h |    6 ++++-
 drivers/staging/lustre/lustre/llite/file.c        |   29 +++++++++++++++++++++
 drivers/staging/lustre/lustre/lov/lov_io.c        |    1 +
 drivers/staging/lustre/lustre/osc/osc_io.c        |   21 +++++++--------
 4 files changed, 44 insertions(+), 13 deletions(-)

diff --git a/drivers/staging/lustre/lustre/include/cl_object.h b/drivers/staging/lustre/lustre/include/cl_object.h
index 4d692dc..76e1b68 100644
--- a/drivers/staging/lustre/lustre/include/cl_object.h
+++ b/drivers/staging/lustre/lustre/include/cl_object.h
@@ -2392,7 +2392,11 @@ struct cl_io {
 	/**
 	 * file is released, restore has to to be triggered by vvp layer
 	 */
-			     ci_restore_needed:1;
+			     ci_restore_needed:1,
+	/**
+	 * O_NOATIME
+	 */
+			     ci_noatime:1;
 	/**
 	 * Number of pages owned by this IO. For invariant checking.
 	 */
diff --git a/drivers/staging/lustre/lustre/llite/file.c b/drivers/staging/lustre/lustre/llite/file.c
index 04dc9ce..390bea5 100644
--- a/drivers/staging/lustre/lustre/llite/file.c
+++ b/drivers/staging/lustre/lustre/llite/file.c
@@ -1032,6 +1032,33 @@ int ll_glimpse_ioctl(struct ll_sb_info *sbi, struct lov_stripe_md *lsm,
 	return rc;
 }
 
+static bool file_is_noatime(const struct file *file)
+{
+	const struct vfsmount *mnt = file->f_path.mnt;
+	const struct inode *inode = file->f_path.dentry->d_inode;
+
+	/* Adapted from file_accessed() and touch_atime().*/
+	if (file->f_flags & O_NOATIME)
+		return true;
+
+	if (inode->i_flags & S_NOATIME)
+		return true;
+
+	if (IS_NOATIME(inode))
+		return true;
+
+	if (mnt->mnt_flags & (MNT_NOATIME | MNT_READONLY))
+		return true;
+
+	if ((mnt->mnt_flags & MNT_NODIRATIME) && S_ISDIR(inode->i_mode))
+		return true;
+
+	if ((inode->i_sb->s_flags & MS_NODIRATIME) && S_ISDIR(inode->i_mode))
+		return true;
+
+	return false;
+}
+
 void ll_io_init(struct cl_io *io, const struct file *file, int write)
 {
 	struct inode *inode = file->f_dentry->d_inode;
@@ -1051,6 +1078,8 @@ void ll_io_init(struct cl_io *io, const struct file *file, int write)
 	} else if (file->f_flags & O_APPEND) {
 		io->ci_lockreq = CILR_MANDATORY;
 	}
+
+	io->ci_noatime = file_is_noatime(file);
 }
 
 static ssize_t
diff --git a/drivers/staging/lustre/lustre/lov/lov_io.c b/drivers/staging/lustre/lustre/lov/lov_io.c
index cdd69232..0a32f98 100644
--- a/drivers/staging/lustre/lustre/lov/lov_io.c
+++ b/drivers/staging/lustre/lustre/lov/lov_io.c
@@ -194,6 +194,7 @@ static int lov_io_sub_init(const struct lu_env *env, struct lov_io *lio,
 		sub_io->ci_lockreq = io->ci_lockreq;
 		sub_io->ci_type    = io->ci_type;
 		sub_io->ci_no_srvlock = io->ci_no_srvlock;
+		sub_io->ci_noatime = io->ci_noatime;
 
 		lov_sub_enter(sub);
 		result = cl_io_sub_init(sub->sub_env, sub_io,
diff --git a/drivers/staging/lustre/lustre/osc/osc_io.c b/drivers/staging/lustre/lustre/osc/osc_io.c
index 681d60a..e567f2f 100644
--- a/drivers/staging/lustre/lustre/osc/osc_io.c
+++ b/drivers/staging/lustre/lustre/osc/osc_io.c
@@ -509,22 +509,19 @@ static void osc_io_setattr_end(const struct lu_env *env,
 static int osc_io_read_start(const struct lu_env *env,
 			     const struct cl_io_slice *slice)
 {
-	struct osc_io    *oio   = cl2osc_io(env, slice);
-	struct cl_object *obj   = slice->cis_obj;
-	struct cl_attr   *attr  = &osc_env_info(env)->oti_attr;
-	int	      result = 0;
+	struct osc_io	 *oio  = cl2osc_io(env, slice);
+	struct cl_object *obj  = slice->cis_obj;
+	struct cl_attr	 *attr = &osc_env_info(env)->oti_attr;
+	int rc = 0;
 
-	if (oio->oi_lockless == 0) {
+	if (oio->oi_lockless == 0 && !slice->cis_io->ci_noatime) {
 		cl_object_attr_lock(obj);
-		result = cl_object_attr_get(env, obj, attr);
-		if (result == 0) {
-			attr->cat_atime = LTIME_S(CURRENT_TIME);
-			result = cl_object_attr_set(env, obj, attr,
-						    CAT_ATIME);
-		}
+		attr->cat_atime = LTIME_S(CURRENT_TIME);
+		rc = cl_object_attr_set(env, obj, attr, CAT_ATIME);
 		cl_object_attr_unlock(obj);
 	}
-	return result;
+
+	return rc;
 }
 
 static int osc_io_write_start(const struct lu_env *env,
-- 
1.7.9.5


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

* [PATCH 33/39] staging/lustre/llite: return compatible fsid for statfs
  2013-11-14 16:32 [PATCH 00/39] staging/lustre: patch bomb 2 Peng Tao
                   ` (31 preceding siblings ...)
  2013-11-14 16:32 ` [PATCH 32/39] staging/lustre/clio: honor O_NOATIME Peng Tao
@ 2013-11-14 16:32 ` Peng Tao
  2013-11-14 16:32 ` [PATCH 34/39] staging/lustre/llite: cancel open lock before closing file Peng Tao
                   ` (5 subsequent siblings)
  38 siblings, 0 replies; 42+ messages in thread
From: Peng Tao @ 2013-11-14 16:32 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-kernel, Fan Yong, Peng Tao, Andreas Dilger

From: Fan Yong <fan.yong@intel.com>

Lustre uses 64-bits inode number to identify object on client side.
When re-export Lustre via NFS, NFS will detect whether support fsid
via statfs(). For the non-support case, it will only recognizes and
packs low 32-bits inode number in nfs handle. Such handle cannot be
used to locate the object properly.
To avoid patch linux kernel, Lustre client should generate fsid and
return it via statfs() to up layer.

To be compatible with old Lustre client (NFS server), the fsid will
be generated from super_block::s_dev.

Lustre-change: http://review.whamcloud.com/7434
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-2904
Signed-off-by: Fan Yong <fan.yong@intel.com>
Reviewed-by: Bobi Jam <bobijam@gmail.com>
Reviewed-by: Jian Yu <jian.yu@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: Peng Tao <bergwolf@gmail.com>
Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
---
 .../staging/lustre/lustre/llite/llite_internal.h   |    2 --
 drivers/staging/lustre/lustre/llite/llite_lib.c    |    8 ++++----
 drivers/staging/lustre/lustre/llite/llite_nfs.c    |   16 ----------------
 3 files changed, 4 insertions(+), 22 deletions(-)

diff --git a/drivers/staging/lustre/lustre/llite/llite_internal.h b/drivers/staging/lustre/lustre/llite/llite_internal.h
index 69b5d91..6148ec4 100644
--- a/drivers/staging/lustre/lustre/llite/llite_internal.h
+++ b/drivers/staging/lustre/lustre/llite/llite_internal.h
@@ -527,7 +527,6 @@ struct ll_sb_info {
 						 * clustred nfs */
 	struct rmtacl_ctl_table   ll_rct;
 	struct eacl_table	 ll_et;
-	__kernel_fsid_t		  ll_fsid;
 };
 
 #define LL_DEFAULT_MAX_RW_CHUNK      (32 * 1024 * 1024)
@@ -872,7 +871,6 @@ char *ll_get_fsname(struct super_block *sb, char *buf, int buflen);
 /* llite/llite_nfs.c */
 extern struct export_operations lustre_export_operations;
 __u32 get_uuid2int(const char *name, int len);
-void get_uuid2fsid(const char *name, int len, __kernel_fsid_t *fsid);
 struct inode *search_inode_for_lustre(struct super_block *sb,
 				      const struct lu_fid *fid);
 
diff --git a/drivers/staging/lustre/lustre/llite/llite_lib.c b/drivers/staging/lustre/lustre/llite/llite_lib.c
index a64808c..a6e95bc 100644
--- a/drivers/staging/lustre/lustre/llite/llite_lib.c
+++ b/drivers/staging/lustre/lustre/llite/llite_lib.c
@@ -574,10 +574,8 @@ static int client_common_fill_super(struct super_block *sb, char *md, char *dt,
 	/* s_dev is also used in lt_compare() to compare two fs, but that is
 	 * only a node-local comparison. */
 	uuid = obd_get_uuid(sbi->ll_md_exp);
-	if (uuid != NULL) {
+	if (uuid != NULL)
 		sb->s_dev = get_uuid2int(uuid->uuid, strlen(uuid->uuid));
-		get_uuid2fsid(uuid->uuid, strlen(uuid->uuid), &sbi->ll_fsid);
-	}
 
 	if (data != NULL)
 		OBD_FREE_PTR(data);
@@ -1612,6 +1610,7 @@ int ll_statfs(struct dentry *de, struct kstatfs *sfs)
 {
 	struct super_block *sb = de->d_sb;
 	struct obd_statfs osfs;
+	__u64 fsid = huge_encode_dev(sb->s_dev);
 	int rc;
 
 	CDEBUG(D_VFSTRACE, "VFS Op: at "LPU64" jiffies\n", get_jiffies_64());
@@ -1643,7 +1642,8 @@ int ll_statfs(struct dentry *de, struct kstatfs *sfs)
 	sfs->f_blocks = osfs.os_blocks;
 	sfs->f_bfree = osfs.os_bfree;
 	sfs->f_bavail = osfs.os_bavail;
-	sfs->f_fsid = ll_s2sbi(sb)->ll_fsid;
+	sfs->f_fsid.val[0] = (__u32)fsid;
+	sfs->f_fsid.val[1] = (__u32)(fsid >> 32);
 	return 0;
 }
 
diff --git a/drivers/staging/lustre/lustre/llite/llite_nfs.c b/drivers/staging/lustre/lustre/llite/llite_nfs.c
index 3580069..d0948e0 100644
--- a/drivers/staging/lustre/lustre/llite/llite_nfs.c
+++ b/drivers/staging/lustre/lustre/llite/llite_nfs.c
@@ -58,22 +58,6 @@ __u32 get_uuid2int(const char *name, int len)
 	return (key0 << 1);
 }
 
-void get_uuid2fsid(const char *name, int len, __kernel_fsid_t *fsid)
-{
-	__u64 key = 0, key0 = 0x12a3fe2d, key1 = 0x37abe8f9;
-
-	while (len--) {
-		key = key1 + (key0 ^ (*name++ * 7152373));
-		if (key & 0x8000000000000000ULL)
-			key -= 0x7fffffffffffffffULL;
-		key1 = key0;
-		key0 = key;
-	}
-
-	fsid->val[0] = key;
-	fsid->val[1] = key >> 32;
-}
-
 static int ll_nfs_test_inode(struct inode *inode, void *opaque)
 {
 	return lu_fid_eq(&ll_i2info(inode)->lli_fid,
-- 
1.7.9.5


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

* [PATCH 34/39] staging/lustre/llite: cancel open lock before closing file
  2013-11-14 16:32 [PATCH 00/39] staging/lustre: patch bomb 2 Peng Tao
                   ` (32 preceding siblings ...)
  2013-11-14 16:32 ` [PATCH 33/39] staging/lustre/llite: return compatible fsid for statfs Peng Tao
@ 2013-11-14 16:32 ` Peng Tao
  2013-11-14 16:32 ` [PATCH 35/39] staging/lustre/hsm: Add support to drop all pages for ll_data_version Peng Tao
                   ` (4 subsequent siblings)
  38 siblings, 0 replies; 42+ messages in thread
From: Peng Tao @ 2013-11-14 16:32 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-kernel, Jinshan Xiong, Peng Tao, Andreas Dilger

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.

Lustre-change: http://review.whamcloud.com/7346
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3647
Signed-off-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: Peng Tao <bergwolf@gmail.com>
Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
---
 drivers/staging/lustre/lustre/llite/file.c |   18 +++++++++++-------
 1 file changed, 11 insertions(+), 7 deletions(-)

diff --git a/drivers/staging/lustre/lustre/llite/file.c b/drivers/staging/lustre/lustre/llite/file.c
index 390bea5..a2a9844 100644
--- a/drivers/staging/lustre/lustre/llite/file.c
+++ b/drivers/staging/lustre/lustre/llite/file.c
@@ -847,20 +847,24 @@ struct obd_client_handle *ll_lease_open(struct inode *inode, struct file *file,
 	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);
 		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:
-	OBD_FREE_PTR(och);
+	if (och != NULL)
+		OBD_FREE_PTR(och);
 	return ERR_PTR(rc);
 }
 EXPORT_SYMBOL(ll_lease_open);
-- 
1.7.9.5


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

* [PATCH 35/39] staging/lustre/hsm: Add support to drop all pages for ll_data_version
  2013-11-14 16:32 [PATCH 00/39] staging/lustre: patch bomb 2 Peng Tao
                   ` (33 preceding siblings ...)
  2013-11-14 16:32 ` [PATCH 34/39] staging/lustre/llite: cancel open lock before closing file Peng Tao
@ 2013-11-14 16:32 ` Peng Tao
  2013-11-14 16:32 ` [PATCH 36/39] staging/lustre/build: fix 'no effect' errors Peng Tao
                   ` (3 subsequent siblings)
  38 siblings, 0 replies; 42+ messages in thread
From: Peng Tao @ 2013-11-14 16:32 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-kernel, Jinshan Xiong, Peng Tao, Andreas Dilger

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.

Lustre-change: http://review.whamcloud.com/6794
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3647
Signed-off-by: Jinshan Xiong <jinshan.xiong@intel.com>
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: Peng Tao <bergwolf@gmail.com>
Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
---
 .../lustre/lustre/include/lustre/lustre_idl.h      |    1 +
 .../lustre/lustre/include/lustre/lustre_user.h     |    4 +--
 drivers/staging/lustre/lustre/llite/dir.c          |    5 ++-
 drivers/staging/lustre/lustre/llite/file.c         |   36 ++++++++++++--------
 .../staging/lustre/lustre/llite/llite_internal.h   |    2 +-
 drivers/staging/lustre/lustre/lov/lov_merge.c      |   13 ++++++-
 6 files changed, 40 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 15f70dc..15ae8e8 100644
--- a/drivers/staging/lustre/lustre/include/lustre/lustre_idl.h
+++ b/drivers/staging/lustre/lustre/include/lustre/lustre_idl.h
@@ -1506,6 +1506,7 @@ enum obdo_flags {
 					   * clients prior than 2.2 */
 	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 ffb56d7..e982dbc 100644
--- a/drivers/staging/lustre/lustre/include/lustre/lustre_user.h
+++ b/drivers/staging/lustre/lustre/include/lustre/lustre_user.h
@@ -849,8 +849,8 @@ struct ioc_data_version {
 	__u64 idv_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 (1 << 0) /* Flush dirty pages from clients */
+#define LL_DV_WR_FLUSH (1 << 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 1856701..00a782d 100644
--- a/drivers/staging/lustre/lustre/llite/dir.c
+++ b/drivers/staging/lustre/lustre/llite/dir.c
@@ -929,7 +929,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 "
@@ -1012,8 +1012,7 @@ static int ll_ioc_copy_end(struct super_block *sb, struct hsm_copy *copy)
 			GOTO(progress, rc = PTR_ERR(inode));
 		}
 
-		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. "
diff --git a/drivers/staging/lustre/lustre/llite/file.c b/drivers/staging/lustre/lustre/llite/file.c
index a2a9844..9fa2cd6 100644
--- a/drivers/staging/lustre/lustre/llite/file.c
+++ b/drivers/staging/lustre/lustre/llite/file.c
@@ -905,7 +905,7 @@ EXPORT_SYMBOL(ll_lease_close);
 /* Fills the obdo with the attributes for the lsm */
 static int ll_lsm_getattr(struct lov_stripe_md *lsm, struct obd_export *exp,
 			  struct obd_capa *capa, struct obdo *obdo,
-			  __u64 ioepoch, int sync)
+			  __u64 ioepoch, int dv_flags)
 {
 	struct ptlrpc_request_set *set;
 	struct obd_info	    oinfo = { { { 0 } } };
@@ -925,9 +925,11 @@ static int ll_lsm_getattr(struct lov_stripe_md *lsm, struct obd_export *exp,
 			       OBD_MD_FLGROUP | OBD_MD_FLEPOCH |
 			       OBD_MD_FLDATAVERSION;
 	oinfo.oi_capa = capa;
-	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();
@@ -940,11 +942,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;
 }
 
@@ -961,7 +968,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),
-			    capa, obdo, ioepoch, sync);
+				capa, obdo, ioepoch, sync ? LL_DV_RD_FLUSH : 0);
 	capa_put(capa);
 	if (rc == 0) {
 		struct ost_id *oi = lsm ? &lsm->lsm_oi : &obdo->o_oi;
@@ -1905,11 +1912,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);
@@ -1928,7 +1936,7 @@ int ll_data_version(struct inode *inode, __u64 *data_version,
 	if (obdo == NULL)
 		GOTO(out, rc = -ENOMEM);
 
-	rc = ll_lsm_getattr(lsm, sbi->ll_dt_exp, NULL, obdo, 0, extent_lock);
+	rc = ll_lsm_getattr(lsm, sbi->ll_dt_exp, NULL, obdo, 0, flags);
 	if (rc == 0) {
 		if (!(obdo->o_valid & OBD_MD_FLDATAVERSION))
 			rc = -EOPNOTSUPP;
@@ -1963,7 +1971,7 @@ int ll_hsm_release(struct inode *inode)
 		GOTO(out, rc = PTR_ERR(och));
 
 	/* 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, rc);
 
@@ -2335,13 +2343,13 @@ long ll_file_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
 		return ll_fid2path(inode, (void *)arg);
 	case LL_IOC_DATA_VERSION: {
 		struct ioc_data_version	idv;
-		int			rc;
+		int rc;
 
 		if (copy_from_user(&idv, (char *)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 *) 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 6148ec4..942601b 100644
--- a/drivers/staging/lustre/lustre/llite/llite_internal.h
+++ b/drivers/staging/lustre/lustre/llite/llite_internal.h
@@ -805,7 +805,7 @@ int ll_merge_lvb(const struct lu_env *env, struct inode *inode);
 int ll_get_grouplock(struct inode *inode, struct file *file, unsigned long arg);
 int ll_put_grouplock(struct inode *inode, struct file *file, unsigned long arg);
 int ll_fid2path(struct inode *inode, void *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);
 
 struct obd_client_handle *ll_lease_open(struct inode *inode, struct file *file,
diff --git a/drivers/staging/lustre/lustre/lov/lov_merge.c b/drivers/staging/lustre/lustre/lov/lov_merge.c
index d204fed..fcfb1e5 100644
--- a/drivers/staging/lustre/lustre/lov/lov_merge.c
+++ b/drivers/staging/lustre/lustre/lov/lov_merge.c
@@ -181,7 +181,8 @@ void lov_merge_attrs(struct obdo *tgt, struct obdo *src, obd_valid valid,
 {
 	valid &= src->o_valid;
 
-	if (*set) {
+	if (*set != 0) {
+		tgt->o_valid &= valid;
 		if (valid & OBD_MD_FLSIZE) {
 			/* this handles sparse files properly */
 			obd_size lov_size;
@@ -200,12 +201,22 @@ void lov_merge_attrs(struct obdo *tgt, struct obdo *src, obd_valid 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.9.5


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

* [PATCH 36/39] staging/lustre/build: fix 'no effect' errors
  2013-11-14 16:32 [PATCH 00/39] staging/lustre: patch bomb 2 Peng Tao
                   ` (34 preceding siblings ...)
  2013-11-14 16:32 ` [PATCH 35/39] staging/lustre/hsm: Add support to drop all pages for ll_data_version Peng Tao
@ 2013-11-14 16:32 ` Peng Tao
  2013-11-14 16:33 ` [PATCH 37/39] staging/lustre/obd: add md_stats to MDC and LMV devices Peng Tao
                   ` (2 subsequent siblings)
  38 siblings, 0 replies; 42+ messages in thread
From: Peng Tao @ 2013-11-14 16:32 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: linux-kernel, Sebastien Buisson, Peng Tao, Andreas Dilger

From: Sebastien Buisson <sebastien.buisson@bull.net>

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.

Lustre-change: http://review.whamcloud.com/7166
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3097
Signed-off-by: Sebastien Buisson <sebastien.buisson@bull.net>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: Peng Tao <bergwolf@gmail.com>
Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
---
 drivers/staging/lustre/lustre/llite/xattr.c     |    5 ++---
 drivers/staging/lustre/lustre/lmv/lmv_obd.c     |    2 +-
 drivers/staging/lustre/lustre/lov/lov_obd.c     |    2 +-
 drivers/staging/lustre/lustre/ptlrpc/sec_bulk.c |    1 -
 4 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/lustre/lustre/llite/xattr.c b/drivers/staging/lustre/lustre/llite/xattr.c
index b6cb0db..b1384ff 100644
--- a/drivers/staging/lustre/lustre/llite/xattr.c
+++ b/drivers/staging/lustre/lustre/llite/xattr.c
@@ -410,11 +410,10 @@ getxattr_nocache:
 	}
 
 #ifdef CONFIG_FS_POSIX_ACL
-	if (rce && rce->rce_ops == RMT_LSETFACL) {
+	if (rce != NULL && 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))
 			GOTO(out, rc = PTR_ERR(acl));
 
diff --git a/drivers/staging/lustre/lustre/lmv/lmv_obd.c b/drivers/staging/lustre/lustre/lmv/lmv_obd.c
index 2587f1a..d3e7d6b 100644
--- a/drivers/staging/lustre/lustre/lmv/lmv_obd.c
+++ b/drivers/staging/lustre/lustre/lmv/lmv_obd.c
@@ -947,7 +947,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];
diff --git a/drivers/staging/lustre/lustre/lov/lov_obd.c b/drivers/staging/lustre/lustre/lov/lov_obd.c
index 4783450..b35a654 100644
--- a/drivers/staging/lustre/lustre/lov/lov_obd.c
+++ b/drivers/staging/lustre/lustre/lov/lov_obd.c
@@ -1982,7 +1982,7 @@ static int lov_iocontrol(unsigned int cmd, struct obd_export *exp, int len,
 		struct obd_quotactl *oqctl;
 
 		if (qctl->qc_valid == QC_OSTIDX) {
-			if (qctl->qc_idx < 0 || count <= qctl->qc_idx)
+			if (count <= qctl->qc_idx)
 				return -EINVAL;
 
 			tgt = lov->lov_tgts[qctl->qc_idx];
diff --git a/drivers/staging/lustre/lustre/ptlrpc/sec_bulk.c b/drivers/staging/lustre/lustre/ptlrpc/sec_bulk.c
index 316103a..b9a3e6f 100644
--- a/drivers/staging/lustre/lustre/ptlrpc/sec_bulk.c
+++ b/drivers/staging/lustre/lustre/ptlrpc/sec_bulk.c
@@ -451,7 +451,6 @@ out:
 static inline void enc_pools_wakeup(void)
 {
 	LASSERT(spin_is_locked(&page_pools.epp_lock));
-	LASSERT(page_pools.epp_waitqlen >= 0);
 
 	if (unlikely(page_pools.epp_waitqlen)) {
 		LASSERT(waitqueue_active(&page_pools.epp_waitq));
-- 
1.7.9.5


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

* [PATCH 37/39] staging/lustre/obd: add md_stats to MDC and LMV devices
  2013-11-14 16:32 [PATCH 00/39] staging/lustre: patch bomb 2 Peng Tao
                   ` (35 preceding siblings ...)
  2013-11-14 16:32 ` [PATCH 36/39] staging/lustre/build: fix 'no effect' errors Peng Tao
@ 2013-11-14 16:33 ` Peng Tao
  2013-11-14 16:33 ` [PATCH 38/39] staging/lustre/autoconf: remove LC_SECURITY_PLUG test Peng Tao
  2013-11-14 16:33 ` [PATCH 39/39] staging/lustre/osc: Lustre returns EINTR from writes when SA_RESTART is set Peng Tao
  38 siblings, 0 replies; 42+ messages in thread
From: Peng Tao @ 2013-11-14 16:33 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: linux-kernel, John L. Hammond, John L. Hammond, Peng Tao, Andreas Dilger

From: "John L. Hammond" <jhammond@tacc.utexas.edu>

Enable md_stats for MDC and LMV devices and fix the definition of
EXP_MD_COUNTER_INCREMENT() so that they will be tallied. These stats
track usage of the md_ops methods (from the OBD layer, not to be
confused with md_device methods) and are exported through the files
/proc/fs/lustre/{lmv,mdc}/*/md_stats.

Rename m_sync to m_fsync making the counter name (fsync) more
intuitive. Prune the minimally useful operations from set of md_ops to
be counted. The operations counted are close, create, enqueue,
getattr, intent_lock, link, rename, setattr, fsync, readpage, unlink,
setxattr, egtxattr, intent_getattr_async, and revalidate_lock.

Add assertions to lprocfs_counter_{add,sub}() to ensure that the
counter index lies in the appropriate range for stats. Remove the
corresponding assertions from OBD_COUNTER_INCREMENT(),
EXP_COUNTER_INCREMENT(), and EXP_MD_COUNTER_INCREMENT(). Add macros
NUM_OBD_STATS and NUM_MD_STATS for use when allocating stats.

In mdt_export_stats_init() allocate and initialize the nid_stats
member of struct exp_nid_stats using only the MDT private
counters. This does not affect the contents of
/proc/fs/lustre/mdt/*/exports/*/stats but does save memory.

Add a flag to struct obd_device to indicate if EXP_COUNTER_INCREMENT()
should increment stats in the nid_stats member (as in the case of OFD)
or not (MDT).

Remove the unused member exp_md_stats from struct obd_export.

Lustre-change: http://review.whamcloud.com/4827
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-2484
Signed-off-by: John L. Hammond <jhammond@tacc.utexas.edu>
Signed-off-by: John L. Hammond <john.hammond@intel.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Reviewed-by: wangdi <di.wang@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: Peng Tao <bergwolf@gmail.com>
Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
---
 .../staging/lustre/lustre/include/lustre_export.h  |    1 -
 drivers/staging/lustre/lustre/include/obd.h        |  139 ++++++++++++--------
 drivers/staging/lustre/lustre/include/obd_class.h  |  119 +++++++----------
 drivers/staging/lustre/lustre/llite/file.c         |    4 +-
 drivers/staging/lustre/lustre/lmv/lmv_obd.c        |   21 +--
 drivers/staging/lustre/lustre/lvfs/lvfs_lib.c      |    6 +
 drivers/staging/lustre/lustre/mdc/mdc_request.c    |    8 +-
 .../lustre/lustre/obdclass/lprocfs_status.c        |   58 +++++---
 8 files changed, 198 insertions(+), 158 deletions(-)

diff --git a/drivers/staging/lustre/lustre/include/lustre_export.h b/drivers/staging/lustre/lustre/include/lustre_export.h
index 2feb38b..6db935e 100644
--- a/drivers/staging/lustre/lustre/include/lustre_export.h
+++ b/drivers/staging/lustre/lustre/include/lustre_export.h
@@ -191,7 +191,6 @@ struct obd_export {
 	 */
 	struct obd_import	*exp_imp_reverse;
 	struct nid_stat	  *exp_nid_stats;
-	struct lprocfs_stats     *exp_md_stats;
 	/** Active connetion */
 	struct ptlrpc_connection *exp_connection;
 	/** Connection count value from last succesful reconnect rpc */
diff --git a/drivers/staging/lustre/lustre/include/obd.h b/drivers/staging/lustre/lustre/include/obd.h
index c3470ce..a643bf1 100644
--- a/drivers/staging/lustre/lustre/include/obd.h
+++ b/drivers/staging/lustre/lustre/include/obd.h
@@ -822,35 +822,38 @@ struct obd_llog_group {
 #define OBD_DEV_BY_DEVNAME      0xffffd0de
 
 struct obd_device {
-	struct obd_type	*obd_type;
-	__u32		   obd_magic;
+	struct obd_type		*obd_type;
+	__u32			 obd_magic;
 
 	/* common and UUID name of this device */
-	char		    obd_name[MAX_OBD_NAME];
-	struct obd_uuid	 obd_uuid;
+	char			 obd_name[MAX_OBD_NAME];
+	struct obd_uuid		 obd_uuid;
+	int			 obd_minor;
+	struct lu_device	*obd_lu_dev;
 
-	struct lu_device       *obd_lu_dev;
-
-	int		     obd_minor;
 	/* bitfield modification is protected by obd_dev_lock */
-	unsigned long obd_attached:1,      /* finished attach */
-		      obd_set_up:1,	/* finished setup */
-		      obd_recovering:1,    /* there are recoverable clients */
-		      obd_abort_recovery:1,/* recovery expired */
-		      obd_version_recov:1, /* obd uses version checking */
-		      obd_replayable:1,    /* recovery is enabled; inform clients */
-		      obd_no_transno:1,    /* no committed-transno notification */
-		      obd_no_recov:1,      /* fail instead of retry messages */
-		      obd_stopping:1,      /* started cleanup */
-		      obd_starting:1,      /* started setup */
-		      obd_force:1,	 /* cleanup with > 0 obd refcount */
-		      obd_fail:1,	  /* cleanup with failover */
-		      obd_async_recov:1,   /* allow asynchronous orphan cleanup */
-		      obd_no_conn:1,       /* deny new connections */
-		      obd_inactive:1,      /* device active/inactive
-					   * (for /proc/status only!!) */
-		      obd_no_ir:1,	 /* no imperative recovery. */
-		      obd_process_conf:1;  /* device is processing mgs config */
+	unsigned long
+		obd_attached:1,		/* finished attach */
+		obd_set_up:1,		/* finished setup */
+		obd_recovering:1,	/* there are recoverable clients */
+		obd_abort_recovery:1,	/* recovery expired */
+		obd_version_recov:1,	/* obd uses version checking */
+		obd_replayable:1,	/* recovery is enabled;
+					 * inform clients */
+		obd_no_transno:1,	/* no committed-transno notification */
+		obd_no_recov:1,		/* fail instead of retry messages */
+		obd_stopping:1,		/* started cleanup */
+		obd_starting:1,		/* started setup */
+		obd_force:1,		/* cleanup with > 0 obd refcount */
+		obd_fail:1,		/* cleanup with failover */
+		obd_async_recov:1,	/* allow asynchronous orphan cleanup */
+		obd_no_conn:1,		/* deny new connections */
+		obd_inactive:1,		/* device active/inactive
+					 * (for /proc/status only!!) */
+		obd_no_ir:1,		/* no imperative recovery. */
+		obd_process_conf:1,	/* device is processing mgs config */
+		obd_uses_nid_stats:1;	/* maintain per-client OBD stats */
+
 	/* use separate field as it is set in interrupt to don't mess with
 	 * protection of other bits using _bh lock */
 	unsigned long obd_recovery_expired:1;
@@ -862,7 +865,6 @@ struct obd_device {
 	struct cfs_hash	     *obd_nid_stats_hash;
 	struct list_head	      obd_nid_stats;
 	atomic_t	    obd_refcount;
-	wait_queue_head_t	     obd_refcount_waitq;
 	struct list_head	      obd_exports;
 	struct list_head	      obd_unlinked_exports;
 	struct list_head	      obd_delayed_exports;
@@ -916,7 +918,6 @@ struct obd_device {
 	struct list_head		       obd_req_replay_queue;
 	struct list_head		       obd_lock_replay_queue;
 	struct list_head		       obd_final_req_queue;
-	int			      obd_recovery_stage;
 
 	union {
 		struct client_obd cli;
@@ -928,8 +929,8 @@ struct obd_device {
 	unsigned int	   obd_cntr_base;
 	struct lprocfs_stats  *obd_stats;
 
-	unsigned int	   md_cntr_base;
-	struct lprocfs_stats  *md_stats;
+	unsigned int	       obd_md_cntr_base;
+	struct lprocfs_stats  *obd_md_stats;
 
 	struct proc_dir_entry  *obd_proc_entry;
 	void		  *obd_proc_private; /* type private PDEs */
@@ -1329,43 +1330,52 @@ struct md_open_data {
 struct lookup_intent;
 
 struct md_ops {
-	int (*m_getstatus)(struct obd_export *, struct lu_fid *,
-			   struct obd_capa **);
-	int (*m_null_inode)(struct obd_export *, const struct lu_fid *);
-	int (*m_find_cbdata)(struct obd_export *, const struct lu_fid *,
-			     ldlm_iterator_t, void *);
+	/* Every operation from MD_STATS_FIRST_OP up to and including
+	 * MD_STATS_LAST_OP will be counted by EXP_MD_OP_INCREMENT()
+	 * and will appear in /proc/fs/lustre/{lmv,mdc}/.../md_stats.
+	 * Operations after MD_STATS_LAST_OP are excluded from stats.
+	 * There are a few reasons for doing this: we prune the 17
+	 * counters which will be of minimal use in understanding
+	 * metadata utilization, we save memory by allocating 15
+	 * instead of 32 counters, we save cycles by not counting.
+	 *
+	 * MD_STATS_FIRST_OP must be the first member of md_ops.
+	 */
+#define MD_STATS_FIRST_OP m_close
 	int (*m_close)(struct obd_export *, struct md_op_data *,
 		       struct md_open_data *, struct ptlrpc_request **);
+
 	int (*m_create)(struct obd_export *, struct md_op_data *,
 			const void *, int, int, __u32, __u32, cfs_cap_t,
 			__u64, struct ptlrpc_request **);
-	int (*m_done_writing)(struct obd_export *, struct md_op_data  *,
-			      struct md_open_data *);
+
 	int (*m_enqueue)(struct obd_export *, struct ldlm_enqueue_info *,
 			 struct lookup_intent *, struct md_op_data *,
 			 struct lustre_handle *, void *, int,
 			 struct ptlrpc_request **, __u64);
+
 	int (*m_getattr)(struct obd_export *, struct md_op_data *,
 			 struct ptlrpc_request **);
-	int (*m_getattr_name)(struct obd_export *, struct md_op_data *,
-			      struct ptlrpc_request **);
+
 	int (*m_intent_lock)(struct obd_export *, struct md_op_data *,
 			     void *, int, struct lookup_intent *, int,
 			     struct ptlrpc_request **,
 			     ldlm_blocking_callback, __u64);
+
 	int (*m_link)(struct obd_export *, struct md_op_data *,
 		      struct ptlrpc_request **);
+
 	int (*m_rename)(struct obd_export *, struct md_op_data *,
 			const char *, int, const char *, int,
 			struct ptlrpc_request **);
-	int (*m_is_subdir)(struct obd_export *, const struct lu_fid *,
-			   const struct lu_fid *,
-			   struct ptlrpc_request **);
+
 	int (*m_setattr)(struct obd_export *, struct md_op_data *, void *,
 			 int , void *, int, struct ptlrpc_request **,
 			 struct md_open_data **mod);
-	int (*m_sync)(struct obd_export *, const struct lu_fid *,
-		      struct obd_capa *, struct ptlrpc_request **);
+
+	int (*m_fsync)(struct obd_export *, const struct lu_fid *,
+		       struct obd_capa *, struct ptlrpc_request **);
+
 	int (*m_readpage)(struct obd_export *, struct md_op_data *,
 			  struct page **, struct ptlrpc_request **);
 
@@ -1382,6 +1392,32 @@ struct md_ops {
 			  const char *, int, int, int,
 			  struct ptlrpc_request **);
 
+	int (*m_intent_getattr_async)(struct obd_export *,
+				      struct md_enqueue_info *,
+				      struct ldlm_enqueue_info *);
+
+	int (*m_revalidate_lock)(struct obd_export *, struct lookup_intent *,
+				 struct lu_fid *, __u64 *bits);
+#define MD_STATS_LAST_OP m_revalidate_lock
+
+	int (*m_getstatus)(struct obd_export *, struct lu_fid *,
+			   struct obd_capa **);
+
+	int (*m_null_inode)(struct obd_export *, const struct lu_fid *);
+
+	int (*m_find_cbdata)(struct obd_export *, const struct lu_fid *,
+			     ldlm_iterator_t, void *);
+
+	int (*m_done_writing)(struct obd_export *, struct md_op_data  *,
+			      struct md_open_data *);
+
+	int (*m_getattr_name)(struct obd_export *, struct md_op_data *,
+			      struct ptlrpc_request **);
+
+	int (*m_is_subdir)(struct obd_export *, const struct lu_fid *,
+			   const struct lu_fid *,
+			   struct ptlrpc_request **);
+
 	int (*m_init_ea_size)(struct obd_export *, int, int, int);
 
 	int (*m_get_lustre_md)(struct obd_export *, struct ptlrpc_request *,
@@ -1393,8 +1429,10 @@ struct md_ops {
 	int (*m_set_open_replay_data)(struct obd_export *,
 				      struct obd_client_handle *,
 				      struct ptlrpc_request *);
+
 	int (*m_clear_open_replay_data)(struct obd_export *,
 					struct obd_client_handle *);
+
 	int (*m_set_lock_data)(struct obd_export *, __u64 *, void *, __u64 *);
 
 	ldlm_mode_t (*m_lock_match)(struct obd_export *, __u64,
@@ -1405,27 +1443,16 @@ struct md_ops {
 	int (*m_cancel_unused)(struct obd_export *, const struct lu_fid *,
 			       ldlm_policy_data_t *, ldlm_mode_t,
 			       ldlm_cancel_flags_t flags, void *opaque);
+
 	int (*m_renew_capa)(struct obd_export *, struct obd_capa *oc,
 			    renew_capa_cb_t cb);
+
 	int (*m_unpack_capa)(struct obd_export *, struct ptlrpc_request *,
 			     const struct req_msg_field *, struct obd_capa **);
 
 	int (*m_get_remote_perm)(struct obd_export *, const struct lu_fid *,
 				 struct obd_capa *, __u32,
 				 struct ptlrpc_request **);
-
-	int (*m_intent_getattr_async)(struct obd_export *,
-				      struct md_enqueue_info *,
-				      struct ldlm_enqueue_info *);
-
-	int (*m_revalidate_lock)(struct obd_export *, struct lookup_intent *,
-				 struct lu_fid *, __u64 *bits);
-
-	/*
-	 * NOTE: If adding ops, add another LPROCFS_MD_OP_INIT() line to
-	 * lprocfs_alloc_md_stats() in obdclass/lprocfs_status.c. Also, add a
-	 * wrapper function in include/linux/obd_class.h.
-	 */
 };
 
 struct lsm_operations {
diff --git a/drivers/staging/lustre/lustre/include/obd_class.h b/drivers/staging/lustre/lustre/include/obd_class.h
index 8cb7cdf..9610e96 100644
--- a/drivers/staging/lustre/lustre/include/obd_class.h
+++ b/drivers/staging/lustre/lustre/include/obd_class.h
@@ -348,64 +348,57 @@ do {							    \
 
 
 #ifdef LPROCFS
-#define OBD_COUNTER_OFFSET(op)				  \
-	((offsetof(struct obd_ops, o_ ## op) -		  \
-	  offsetof(struct obd_ops, o_iocontrol))		\
-	 / sizeof(((struct obd_ops *)(0))->o_iocontrol))
-
-#define OBD_COUNTER_INCREMENT(obdx, op)			   \
-	if ((obdx)->obd_stats != NULL) {			  \
-		unsigned int coffset;			     \
-		coffset = (unsigned int)((obdx)->obd_cntr_base) + \
-			OBD_COUNTER_OFFSET(op);		   \
-		LASSERT(coffset < (obdx)->obd_stats->ls_num);     \
-		lprocfs_counter_incr((obdx)->obd_stats, coffset); \
-	}
-
-#define EXP_COUNTER_INCREMENT(export, op)				    \
-	if ((export)->exp_obd->obd_stats != NULL) {			  \
-		unsigned int coffset;					\
-		coffset = (unsigned int)((export)->exp_obd->obd_cntr_base) + \
-			OBD_COUNTER_OFFSET(op);			      \
-		LASSERT(coffset < (export)->exp_obd->obd_stats->ls_num);     \
-		lprocfs_counter_incr((export)->exp_obd->obd_stats, coffset); \
-		if ((export)->exp_nid_stats != NULL &&		       \
-		    (export)->exp_nid_stats->nid_stats != NULL)	      \
-			lprocfs_counter_incr(				\
-				(export)->exp_nid_stats->nid_stats, coffset);\
-	}
-
-#define MD_COUNTER_OFFSET(op)				   \
-	((offsetof(struct md_ops, m_ ## op) -		   \
-	  offsetof(struct md_ops, m_getstatus))		 \
-	 / sizeof(((struct md_ops *)(0))->m_getstatus))
-
-#define MD_COUNTER_INCREMENT(obdx, op)			   \
-	if ((obd)->md_stats != NULL) {			   \
-		unsigned int coffset;			    \
-		coffset = (unsigned int)((obdx)->md_cntr_base) + \
-			MD_COUNTER_OFFSET(op);		   \
-		LASSERT(coffset < (obdx)->md_stats->ls_num);     \
-		lprocfs_counter_incr((obdx)->md_stats, coffset); \
-	}
-
-#define EXP_MD_COUNTER_INCREMENT(export, op)				 \
-	if ((export)->exp_obd->obd_stats != NULL) {			  \
-		unsigned int coffset;					\
-		coffset = (unsigned int)((export)->exp_obd->md_cntr_base) +  \
-			MD_COUNTER_OFFSET(op);			       \
-		LASSERT(coffset < (export)->exp_obd->md_stats->ls_num);      \
-		lprocfs_counter_incr((export)->exp_obd->md_stats, coffset);  \
-		if ((export)->exp_md_stats != NULL)			  \
-			lprocfs_counter_incr(				\
-				(export)->exp_md_stats, coffset);	    \
-	}
+#define OBD_COUNTER_OFFSET(op)						       \
+	((offsetof(struct obd_ops, o_ ## op) -				       \
+	  offsetof(struct obd_ops, o_iocontrol))			       \
+	 / sizeof(((struct obd_ops *)NULL)->o_iocontrol))
+
+/* The '- 1' below is for o_owner. */
+#define NUM_OBD_STATS							       \
+	(sizeof(struct obd_ops) /					       \
+	 sizeof(((struct obd_ops *)NULL)->o_iocontrol) - 1)
+
+#define OBD_COUNTER_INCREMENT(obd, op)					       \
+	lprocfs_counter_incr((obd)->obd_stats,				       \
+			     (obd)->obd_cntr_base + OBD_COUNTER_OFFSET(op))
+
+#define EXP_COUNTER_INCREMENT(exp, op)					       \
+	do {								       \
+		unsigned int _off;					       \
+		_off = (exp)->exp_obd->obd_cntr_base + OBD_COUNTER_OFFSET(op); \
+		lprocfs_counter_incr((exp)->exp_obd->obd_stats, _off);	       \
+		if ((exp)->exp_obd->obd_uses_nid_stats &&		       \
+		    (exp)->exp_nid_stats != NULL)			       \
+			lprocfs_counter_incr((exp)->exp_nid_stats->nid_stats,  \
+					     _off);			       \
+	} while (0)
+
+#define _MD_COUNTER_OFFSET(m_op)					       \
+	((offsetof(struct md_ops, m_op) -				       \
+	  offsetof(struct md_ops, MD_STATS_FIRST_OP)) /			       \
+	 sizeof(((struct md_ops *)NULL)->MD_STATS_FIRST_OP))
+
+#define MD_COUNTER_OFFSET(op) _MD_COUNTER_OFFSET(m_ ## op)
+
+#define NUM_MD_STATS							       \
+	(_MD_COUNTER_OFFSET(MD_STATS_LAST_OP) -				       \
+	 _MD_COUNTER_OFFSET(MD_STATS_FIRST_OP) + 1)
+
+/* Note that we only increment md counters for ops whose offset is less
+ * than NUM_MD_STATS. This is explained in a comment in the definition
+ * of struct md_ops. */
+#define EXP_MD_COUNTER_INCREMENT(exp, op)				       \
+	do {								       \
+		if (MD_COUNTER_OFFSET(op) < NUM_MD_STATS)		       \
+			lprocfs_counter_incr((exp)->exp_obd->obd_md_stats,     \
+					(exp)->exp_obd->obd_md_cntr_base +     \
+					MD_COUNTER_OFFSET(op));	               \
+	} while (0)
 
 #else
 #define OBD_COUNTER_OFFSET(op)
 #define OBD_COUNTER_INCREMENT(obd, op)
 #define EXP_COUNTER_INCREMENT(exp, op)
-#define MD_COUNTER_INCREMENT(obd, op)
 #define EXP_MD_COUNTER_INCREMENT(exp, op)
 #endif
 
@@ -423,16 +416,6 @@ static inline int lprocfs_nid_ldlm_stats_init(struct nid_stat* tmp)
 				      tmp->nid_ldlm_stats);
 }
 
-#define OBD_CHECK_MD_OP(obd, op, err)			   \
-do {							    \
-	if (!OBT(obd) || !MDP((obd), op)) {		     \
-		if (err)					\
-			CERROR("md_" #op ": dev %s/%d no operation\n", \
-			       obd->obd_name, obd->obd_minor);  \
-		return err;				    \
-	}						       \
-} while (0)
-
 #define EXP_CHECK_MD_OP(exp, op)				\
 do {							    \
 	if ((exp) == NULL) {				    \
@@ -1908,14 +1891,14 @@ static inline int md_setattr(struct obd_export *exp, struct md_op_data *op_data,
 	return rc;
 }
 
-static inline int md_sync(struct obd_export *exp, const struct lu_fid *fid,
-			  struct obd_capa *oc, struct ptlrpc_request **request)
+static inline int md_fsync(struct obd_export *exp, const struct lu_fid *fid,
+			   struct obd_capa *oc, struct ptlrpc_request **request)
 {
 	int rc;
 
-	EXP_CHECK_MD_OP(exp, sync);
-	EXP_MD_COUNTER_INCREMENT(exp, sync);
-	rc = MDP(exp->exp_obd, sync)(exp, fid, oc, request);
+	EXP_CHECK_MD_OP(exp, fsync);
+	EXP_MD_COUNTER_INCREMENT(exp, fsync);
+	rc = MDP(exp->exp_obd, fsync)(exp, fid, oc, request);
 	return rc;
 }
 
diff --git a/drivers/staging/lustre/lustre/llite/file.c b/drivers/staging/lustre/lustre/llite/file.c
index 9fa2cd6..60b3197 100644
--- a/drivers/staging/lustre/lustre/llite/file.c
+++ b/drivers/staging/lustre/lustre/llite/file.c
@@ -2692,8 +2692,8 @@ int ll_fsync(struct file *file, loff_t start, loff_t end, int datasync)
 	}
 
 	oc = ll_mdscapa_get(inode);
-	err = md_sync(ll_i2sbi(inode)->ll_md_exp, ll_inode2fid(inode), oc,
-		      &req);
+	err = md_fsync(ll_i2sbi(inode)->ll_md_exp, ll_inode2fid(inode), oc,
+		       &req);
 	capa_put(oc);
 	if (!rc)
 		rc = err;
diff --git a/drivers/staging/lustre/lustre/lmv/lmv_obd.c b/drivers/staging/lustre/lustre/lmv/lmv_obd.c
index d3e7d6b..2a1d6e0 100644
--- a/drivers/staging/lustre/lustre/lmv/lmv_obd.c
+++ b/drivers/staging/lustre/lustre/lmv/lmv_obd.c
@@ -1338,6 +1338,7 @@ static int lmv_setup(struct obd_device *obd, struct lustre_cfg *lcfg)
 	lprocfs_lmv_init_vars(&lvars);
 
 	lprocfs_obd_setup(obd, lvars.obd_vars);
+	lprocfs_alloc_md_stats(obd, 0);
 #ifdef LPROCFS
 	{
 		rc = lprocfs_seq_create(obd->obd_proc_entry, "target_obd",
@@ -2035,23 +2036,24 @@ static int lmv_setattr(struct obd_export *exp, struct md_op_data *op_data,
 	return rc;
 }
 
-static int lmv_sync(struct obd_export *exp, const struct lu_fid *fid,
-		    struct obd_capa *oc, struct ptlrpc_request **request)
+static int lmv_fsync(struct obd_export *exp, const struct lu_fid *fid,
+		     struct obd_capa *oc, struct ptlrpc_request **request)
 {
-	struct obd_device	 *obd = exp->exp_obd;
-	struct lmv_obd	    *lmv = &obd->u.lmv;
-	struct lmv_tgt_desc       *tgt;
-	int			rc;
+	struct obd_device	*obd = exp->exp_obd;
+	struct lmv_obd		*lmv = &obd->u.lmv;
+	struct lmv_tgt_desc	*tgt;
+	int			 rc;
+
 
 	rc = lmv_check_connect(obd);
-	if (rc)
+	if (rc != 0)
 		return rc;
 
 	tgt = lmv_find_target(lmv, fid);
 	if (IS_ERR(tgt))
 		return PTR_ERR(tgt);
 
-	rc = md_sync(tgt->ltd_exp, fid, oc, request);
+	rc = md_fsync(tgt->ltd_exp, fid, oc, request);
 	return rc;
 }
 
@@ -2298,6 +2300,7 @@ static int lmv_precleanup(struct obd_device *obd, enum obd_cleanup_stage stage)
 	case OBD_CLEANUP_EXPORTS:
 		fld_client_proc_fini(&lmv->lmv_fld);
 		lprocfs_obd_cleanup(obd);
+		lprocfs_free_md_stats(obd);
 		break;
 	default:
 		break;
@@ -2828,7 +2831,7 @@ struct md_ops lmv_md_ops = {
 	.m_rename	       = lmv_rename,
 	.m_setattr	      = lmv_setattr,
 	.m_setxattr	     = lmv_setxattr,
-	.m_sync		 = lmv_sync,
+	.m_fsync		= lmv_fsync,
 	.m_readpage	     = lmv_readpage,
 	.m_unlink	       = lmv_unlink,
 	.m_init_ea_size	 = lmv_init_ea_size,
diff --git a/drivers/staging/lustre/lustre/lvfs/lvfs_lib.c b/drivers/staging/lustre/lustre/lvfs/lvfs_lib.c
index b21e40c..7579fa8 100644
--- a/drivers/staging/lustre/lustre/lvfs/lvfs_lib.c
+++ b/drivers/staging/lustre/lustre/lvfs/lvfs_lib.c
@@ -54,6 +54,9 @@ void lprocfs_counter_add(struct lprocfs_stats *stats, int idx, long amount)
 	if (stats == NULL)
 		return;
 
+	LASSERTF(0 <= idx && idx < stats->ls_num,
+		 "idx %d, ls_num %hu\n", idx, stats->ls_num);
+
 	/* With per-client stats, statistics are allocated only for
 	 * single CPU area, so the smp_id should be 0 always. */
 	smp_id = lprocfs_stats_lock(stats, LPROCFS_GET_SMP_ID, &flags);
@@ -102,6 +105,9 @@ void lprocfs_counter_sub(struct lprocfs_stats *stats, int idx, long amount)
 	if (stats == NULL)
 		return;
 
+	LASSERTF(0 <= idx && idx < stats->ls_num,
+		 "idx %d, ls_num %hu\n", idx, stats->ls_num);
+
 	/* With per-client stats, statistics are allocated only for
 	 * single CPU area, so the smp_id should be 0 always. */
 	smp_id = lprocfs_stats_lock(stats, LPROCFS_GET_SMP_ID, &flags);
diff --git a/drivers/staging/lustre/lustre/mdc/mdc_request.c b/drivers/staging/lustre/lustre/mdc/mdc_request.c
index eb3b44f..4c30fa8 100644
--- a/drivers/staging/lustre/lustre/mdc/mdc_request.c
+++ b/drivers/staging/lustre/lustre/mdc/mdc_request.c
@@ -2233,8 +2233,8 @@ static int mdc_unpin(struct obd_export *exp, struct obd_client_handle *handle,
 	return rc;
 }
 
-int mdc_sync(struct obd_export *exp, const struct lu_fid *fid,
-	     struct obd_capa *oc, struct ptlrpc_request **request)
+int mdc_fsync(struct obd_export *exp, const struct lu_fid *fid,
+	      struct obd_capa *oc, struct ptlrpc_request **request)
 {
 	struct ptlrpc_request *req;
 	int		    rc;
@@ -2385,6 +2385,7 @@ static int mdc_setup(struct obd_device *obd, struct lustre_cfg *cfg)
 		GOTO(err_close_lock, rc);
 	lprocfs_mdc_init_vars(&lvars);
 	lprocfs_obd_setup(obd, lvars.obd_vars);
+	lprocfs_alloc_md_stats(obd, 0);
 	sptlrpc_lprocfs_cliobd_attach(obd);
 	ptlrpc_lprocfs_register_obd(obd);
 
@@ -2445,6 +2446,7 @@ static int mdc_precleanup(struct obd_device *obd, enum obd_cleanup_stage stage)
 		obd_cleanup_client_import(obd);
 		ptlrpc_lprocfs_unregister_obd(obd);
 		lprocfs_obd_cleanup(obd);
+		lprocfs_free_md_stats(obd);
 
 		rc = obd_llog_finish(obd, 0);
 		if (rc != 0)
@@ -2651,7 +2653,7 @@ struct md_ops mdc_md_ops = {
 	.m_setattr	  = mdc_setattr,
 	.m_setxattr	 = mdc_setxattr,
 	.m_getxattr	 = mdc_getxattr,
-	.m_sync	     = mdc_sync,
+	.m_fsync	    = mdc_fsync,
 	.m_readpage	 = mdc_readpage,
 	.m_unlink	   = mdc_unlink,
 	.m_cancel_unused    = mdc_cancel_unused,
diff --git a/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c b/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c
index 3329055..8f91ab9 100644
--- a/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c
+++ b/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c
@@ -1253,6 +1253,8 @@ void lprocfs_init_ops_stats(int num_private_stats, struct lprocfs_stats *stats)
 	LPROCFS_OBD_OP_INIT(num_private_stats, stats, pool_del);
 	LPROCFS_OBD_OP_INIT(num_private_stats, stats, getref);
 	LPROCFS_OBD_OP_INIT(num_private_stats, stats, putref);
+
+	CLASSERT(NUM_OBD_STATS == OBD_COUNTER_OFFSET(putref) + 1);
 }
 EXPORT_SYMBOL(lprocfs_init_ops_stats);
 
@@ -1266,8 +1268,7 @@ int lprocfs_alloc_obd_stats(struct obd_device *obd, unsigned num_private_stats)
 	LASSERT(obd->obd_proc_entry != NULL);
 	LASSERT(obd->obd_cntr_base == 0);
 
-	num_stats = ((int)sizeof(*obd->obd_type->typ_dt_ops) / sizeof(void *)) +
-		num_private_stats - 1 /* o_owner */;
+	num_stats = NUM_OBD_STATS + num_private_stats;
 	stats = lprocfs_alloc_stats(num_stats, 0);
 	if (stats == NULL)
 		return -ENOMEM;
@@ -1302,12 +1303,18 @@ void lprocfs_free_obd_stats(struct obd_device *obd)
 }
 EXPORT_SYMBOL(lprocfs_free_obd_stats);
 
-#define LPROCFS_MD_OP_INIT(base, stats, op)			     \
-do {								    \
-	unsigned int coffset = base + MD_COUNTER_OFFSET(op);	    \
-	LASSERT(coffset < stats->ls_num);			       \
-	lprocfs_counter_init(stats, coffset, 0, #op, "reqs");	   \
-} while (0)
+/* Note that we only init md counters for ops whose offset is less
+ * than NUM_MD_STATS. This is explained in a comment in the definition
+ * of struct md_ops. */
+#define LPROCFS_MD_OP_INIT(base, stats, op)				       \
+	do {								       \
+		unsigned int _idx = base + MD_COUNTER_OFFSET(op);	       \
+									       \
+		if (MD_COUNTER_OFFSET(op) < NUM_MD_STATS) {		       \
+			LASSERT(_idx < stats->ls_num);			       \
+			lprocfs_counter_init(stats, _idx, 0, #op, "reqs");     \
+		}							       \
+	} while (0)
 
 void lprocfs_init_mps_stats(int num_private_stats, struct lprocfs_stats *stats)
 {
@@ -1325,7 +1332,7 @@ void lprocfs_init_mps_stats(int num_private_stats, struct lprocfs_stats *stats)
 	LPROCFS_MD_OP_INIT(num_private_stats, stats, rename);
 	LPROCFS_MD_OP_INIT(num_private_stats, stats, is_subdir);
 	LPROCFS_MD_OP_INIT(num_private_stats, stats, setattr);
-	LPROCFS_MD_OP_INIT(num_private_stats, stats, sync);
+	LPROCFS_MD_OP_INIT(num_private_stats, stats, fsync);
 	LPROCFS_MD_OP_INIT(num_private_stats, stats, readpage);
 	LPROCFS_MD_OP_INIT(num_private_stats, stats, unlink);
 	LPROCFS_MD_OP_INIT(num_private_stats, stats, setxattr);
@@ -1347,18 +1354,29 @@ void lprocfs_init_mps_stats(int num_private_stats, struct lprocfs_stats *stats)
 EXPORT_SYMBOL(lprocfs_init_mps_stats);
 
 int lprocfs_alloc_md_stats(struct obd_device *obd,
-			   unsigned num_private_stats)
+			   unsigned int num_private_stats)
 {
 	struct lprocfs_stats *stats;
 	unsigned int num_stats;
 	int rc, i;
 
-	LASSERT(obd->md_stats == NULL);
+	CLASSERT(offsetof(struct md_ops, MD_STATS_FIRST_OP) == 0);
+	CLASSERT(_MD_COUNTER_OFFSET(MD_STATS_FIRST_OP) == 0);
+	CLASSERT(_MD_COUNTER_OFFSET(MD_STATS_LAST_OP) > 0);
+
+	/* TODO Ensure that this function is only used where
+	 * appropriate by adding an assertion to the effect that
+	 * obd->obd_type->typ_md_ops is not NULL. We can't do this now
+	 * because mdt_procfs_init() uses this function to allocate
+	 * the stats backing /proc/fs/lustre/mdt/.../md_stats but the
+	 * mdt layer does not use the md_ops interface. This is
+	 * confusing and a waste of memory. See LU-2484.
+	 */
 	LASSERT(obd->obd_proc_entry != NULL);
-	LASSERT(obd->md_cntr_base == 0);
+	LASSERT(obd->obd_md_stats == NULL);
+	LASSERT(obd->obd_md_cntr_base == 0);
 
-	num_stats = 1 + MD_COUNTER_OFFSET(revalidate_lock) +
-		    num_private_stats;
+	num_stats = NUM_MD_STATS + num_private_stats;
 	stats = lprocfs_alloc_stats(num_stats, 0);
 	if (stats == NULL)
 		return -ENOMEM;
@@ -1373,24 +1391,26 @@ int lprocfs_alloc_md_stats(struct obd_device *obd,
 			LBUG();
 		}
 	}
+
 	rc = lprocfs_register_stats(obd->obd_proc_entry, "md_stats", stats);
 	if (rc < 0) {
 		lprocfs_free_stats(&stats);
 	} else {
-		obd->md_stats  = stats;
-		obd->md_cntr_base = num_private_stats;
+		obd->obd_md_stats = stats;
+		obd->obd_md_cntr_base = num_private_stats;
 	}
+
 	return rc;
 }
 EXPORT_SYMBOL(lprocfs_alloc_md_stats);
 
 void lprocfs_free_md_stats(struct obd_device *obd)
 {
-	struct lprocfs_stats *stats = obd->md_stats;
+	struct lprocfs_stats *stats = obd->obd_md_stats;
 
 	if (stats != NULL) {
-		obd->md_stats = NULL;
-		obd->md_cntr_base = 0;
+		obd->obd_md_stats = NULL;
+		obd->obd_md_cntr_base = 0;
 		lprocfs_free_stats(&stats);
 	}
 }
-- 
1.7.9.5


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

* [PATCH 38/39] staging/lustre/autoconf: remove LC_SECURITY_PLUG test
  2013-11-14 16:32 [PATCH 00/39] staging/lustre: patch bomb 2 Peng Tao
                   ` (36 preceding siblings ...)
  2013-11-14 16:33 ` [PATCH 37/39] staging/lustre/obd: add md_stats to MDC and LMV devices Peng Tao
@ 2013-11-14 16:33 ` Peng Tao
  2013-11-14 16:33 ` [PATCH 39/39] staging/lustre/osc: Lustre returns EINTR from writes when SA_RESTART is set Peng Tao
  38 siblings, 0 replies; 42+ messages in thread
From: Peng Tao @ 2013-11-14 16:33 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: linux-kernel, James Simmons, Jeff Mahoney, Peng Tao, Andreas Dilger

From: James Simmons <uja.ornl@gmail.com>

Only the SLES 10 kernel took a vfsmount for various vfs operations
to support AppArmor before the path variants were available.
We can remove the test and the dead code.

Lustre-change: http://review.whamcloud.com/5360
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-2800
Signed-off-by: Jeff Mahoney <jeffm@suse.com>
Signed-off-by: James Simmons <uja.ornl@gmail.com>
Reviewed-by: Bob Glossman <bob.glossman@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: Peng Tao <bergwolf@gmail.com>
Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
---
 .../lustre/lustre/include/linux/lustre_compat25.h  |    9 ---------
 drivers/staging/lustre/lustre/lvfs/lvfs_linux.c    |    3 +--
 2 files changed, 1 insertion(+), 11 deletions(-)

diff --git a/drivers/staging/lustre/lustre/include/linux/lustre_compat25.h b/drivers/staging/lustre/lustre/include/linux/lustre_compat25.h
index 8e1505a..a8b6af1 100644
--- a/drivers/staging/lustre/lustre/include/linux/lustre_compat25.h
+++ b/drivers/staging/lustre/lustre/include/linux/lustre_compat25.h
@@ -99,15 +99,6 @@ static inline void ll_set_fs_pwd(struct fs_struct *fs, struct vfsmount *mnt,
 #define FS_HAS_FIEMAP			(0)
 #endif
 
-#define ll_vfs_rmdir(dir,entry,mnt)	     vfs_rmdir(dir,entry)
-#define ll_vfs_mkdir(inode,dir,mnt,mode)	vfs_mkdir(inode,dir,mode)
-#define ll_vfs_link(old,mnt,dir,new,mnt1)       vfs_link(old,dir,new)
-#define ll_vfs_unlink(inode,entry,mnt)	  vfs_unlink(inode,entry)
-#define ll_vfs_mknod(dir,entry,mnt,mode,dev)    vfs_mknod(dir,entry,mode,dev)
-#define ll_security_inode_unlink(dir,entry,mnt) security_inode_unlink(dir,entry)
-#define ll_vfs_rename(old,old_dir,mnt,new,new_dir,mnt1) \
-		vfs_rename(old,old_dir,new,new_dir)
-
 #define cfs_bio_io_error(a,b)   bio_io_error((a))
 #define cfs_bio_endio(a,b,c)    bio_endio((a),(c))
 
diff --git a/drivers/staging/lustre/lustre/lvfs/lvfs_linux.c b/drivers/staging/lustre/lustre/lvfs/lvfs_linux.c
index 86b09a8..2ca3fc4 100644
--- a/drivers/staging/lustre/lustre/lvfs/lvfs_linux.c
+++ b/drivers/staging/lustre/lustre/lvfs/lvfs_linux.c
@@ -223,8 +223,7 @@ int lustre_rename(struct dentry *dir, struct vfsmount *mnt,
 	if (IS_ERR(dchild_new))
 		GOTO(put_old, err = PTR_ERR(dchild_new));
 
-	err = ll_vfs_rename(dir->d_inode, dchild_old, mnt,
-			    dir->d_inode, dchild_new, mnt);
+	err = vfs_rename(dir->d_inode, dchild_old, dir->d_inode, dchild_new);
 
 	dput(dchild_new);
 put_old:
-- 
1.7.9.5


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

* [PATCH 39/39] staging/lustre/osc: Lustre returns EINTR from writes when SA_RESTART is set
  2013-11-14 16:32 [PATCH 00/39] staging/lustre: patch bomb 2 Peng Tao
                   ` (37 preceding siblings ...)
  2013-11-14 16:33 ` [PATCH 38/39] staging/lustre/autoconf: remove LC_SECURITY_PLUG test Peng Tao
@ 2013-11-14 16:33 ` Peng Tao
  38 siblings, 0 replies; 42+ messages in thread
From: Peng Tao @ 2013-11-14 16:33 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: linux-kernel, James Simmons, Patrick Farrell, Peng Tao, Andreas Dilger

From: James Simmons <uja.ornl@gmail.com>

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.

Lustre-change: http://review.whamcloud.com/7002
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3581
Signed-off-by: Patrick Farrell <paf@cray.com>
Signed-off-by: James Simmons <uja.ornl@gmail.com>
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: Peng Tao <bergwolf@gmail.com>
Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
---
 drivers/staging/lustre/lustre/osc/osc_cache.c |   15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/lustre/lustre/osc/osc_cache.c b/drivers/staging/lustre/lustre/osc/osc_cache.c
index 7d63a37..abb4604 100644
--- a/drivers/staging/lustre/lustre/osc/osc_cache.c
+++ b/drivers/staging/lustre/lustre/osc/osc_cache.c
@@ -1533,13 +1533,24 @@ 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, rc);
 		}
-- 
1.7.9.5


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

* Re: [PATCH 01/39] staging/lustre/hsm: remove hsm_nl proc file
  2013-11-14 16:32 ` [PATCH 01/39] staging/lustre/hsm: remove hsm_nl proc file Peng Tao
@ 2013-11-15  4:26   ` Greg Kroah-Hartman
  2013-11-15 10:32     ` Peng Tao
  0 siblings, 1 reply; 42+ messages in thread
From: Greg Kroah-Hartman @ 2013-11-15  4:26 UTC (permalink / raw)
  To: Peng Tao; +Cc: linux-kernel, John L. Hammond, Andreas Dilger

On Fri, Nov 15, 2013 at 12:32:24AM +0800, Peng Tao wrote:
> From: "John L. Hammond" <john.hammond@intel.com>
> 
> Remove the file /proc/fs/lustre/mdc/*/hsm_nl which was introduced "for
> testing purposes."

What does this mean?  Why is this allowed?  How do you know no one uses
it?  I need a much better changelog comment here, sorry.

greg k-h

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

* Re: [PATCH 01/39] staging/lustre/hsm: remove hsm_nl proc file
  2013-11-15  4:26   ` Greg Kroah-Hartman
@ 2013-11-15 10:32     ` Peng Tao
  0 siblings, 0 replies; 42+ messages in thread
From: Peng Tao @ 2013-11-15 10:32 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Linux Kernel Mailing List, John L. Hammond, Andreas Dilger

On Fri, Nov 15, 2013 at 12:26 PM, Greg Kroah-Hartman
<gregkh@linuxfoundation.org> wrote:
> On Fri, Nov 15, 2013 at 12:32:24AM +0800, Peng Tao wrote:
>> From: "John L. Hammond" <john.hammond@intel.com>
>>
>> Remove the file /proc/fs/lustre/mdc/*/hsm_nl which was introduced "for
>> testing purposes."
>
> What does this mean?  Why is this allowed?  How do you know no one uses
> it?  I need a much better changelog comment here, sorry.
>
Those proc entries were added for testing HSM
(http://en.wikipedia.org/wiki/Hierarchical_storage_management) during
the time of developing Lustre HSM feature. Now the HSM feature is
almost completed, those files no longer serve their purpose and can be
removed so that no one would develop dependency upon it after Lustre
HSM is announced released.

I'll add this to the commit message.

Thanks for reviewing,
Tao

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

end of thread, other threads:[~2013-11-15 10:32 UTC | newest]

Thread overview: 42+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-11-14 16:32 [PATCH 00/39] staging/lustre: patch bomb 2 Peng Tao
2013-11-14 16:32 ` [PATCH 01/39] staging/lustre/hsm: remove hsm_nl proc file Peng Tao
2013-11-15  4:26   ` Greg Kroah-Hartman
2013-11-15 10:32     ` Peng Tao
2013-11-14 16:32 ` [PATCH 02/39] staging/lustre/clio: wrong cl_lock usage Peng Tao
2013-11-14 16:32 ` [PATCH 03/39] staging/lustre/build: fix 'deadcode' errors Peng Tao
2013-11-14 16:32 ` [PATCH 04/39] staging/lustre/build: fix 'integer handling' issues Peng Tao
2013-11-14 16:32 ` [PATCH 05/39] staging/lustre/ptlrpc: add rpc_cache Peng Tao
2013-11-14 16:32 ` [PATCH 06/39] staging/lustre/lnet: build Lustre with Intel OFED for Xeon Phi Peng Tao
2013-11-14 16:32 ` [PATCH 07/39] staging/lustre/osd-ldiskfs: remove dependency on mdd module Peng Tao
2013-11-14 16:32 ` [PATCH 08/39] staging/lustre/libcfs: improve validity test for valid file descriptors Peng Tao
2013-11-14 16:32 ` [PATCH 09/39] staging/lustre/llite: use 64bits flags in ll_lov_setea() Peng Tao
2013-11-14 16:32 ` [PATCH 10/39] staging/lustre/hsm: small fixes for HSM Peng Tao
2013-11-14 16:32 ` [PATCH 11/39] staging/lustre/mdt: CDT cleanup follow-on patch Peng Tao
2013-11-14 16:32 ` [PATCH 12/39] staging/lustre/utils: Posix copytool fixes Peng Tao
2013-11-14 16:32 ` [PATCH 13/39] staging/lustre/lmv: update coding style Peng Tao
2013-11-14 16:32 ` [PATCH 14/39] staging/lustre/hsm: copy start error should set HP_FLAG_COMPLETED Peng Tao
2013-11-14 16:32 ` [PATCH 15/39] staging/lustre/lov: Get the correct address of lmm_objects Peng Tao
2013-11-14 16:32 ` [PATCH 16/39] staging/lustre/lvfs: remove llog_lvfs.c and other lvfs code from llog Peng Tao
2013-11-14 16:32 ` [PATCH 17/39] staging/lustre/llite: reset writeback index in ll_writepages Peng Tao
2013-11-14 16:32 ` [PATCH 18/39] staging/lustre/llite: Delaying creation of client side proc entries Peng Tao
2013-11-14 16:32 ` [PATCH 19/39] staging/lustre/libcfs: Add relocation function to libcfs heap Peng Tao
2013-11-14 16:32 ` [PATCH 20/39] staging/lustre/build: fix 'data race condition' issues Peng Tao
2013-11-14 16:32 ` [PATCH 21/39] staging/lustre/autoconf: remove LC_LOCK_MAP_ACQUIRE test Peng Tao
2013-11-14 16:32 ` [PATCH 22/39] staging/lustre/mdc: document mdc_rpc_lock Peng Tao
2013-11-14 16:32 ` [PATCH 23/39] staging/lustre/autoconf: remove LC_FS_STRUCT_USE_PATH Peng Tao
2013-11-14 16:32 ` [PATCH 24/39] staging/lustre/obdclass: fix wrong device put in case of race Peng Tao
2013-11-14 16:32 ` [PATCH 25/39] staging/lustre/lmv: choose right MDT for open by FID Peng Tao
2013-11-14 16:32 ` [PATCH 26/39] staging/lustre/osd: remove fld lookup during configuration Peng Tao
2013-11-14 16:32 ` [PATCH 27/39] staging/lustre/mdt: HSM EXIST event not triggered at last rm/mv Peng Tao
2013-11-14 16:32 ` [PATCH 28/39] staging/lustre/ldlm: ldlm_flock_deadlock() ASSERTION( req != lock ) failed Peng Tao
2013-11-14 16:32 ` [PATCH 29/39] staging/lustre/changelogs: Account for changelog_ext_rec in CR_MAXSIZE Peng Tao
2013-11-14 16:32 ` [PATCH 30/39] staging/lustre/build: build error with gcc 4.7.0 20110509 Peng Tao
2013-11-14 16:32 ` [PATCH 31/39] staging/lustre/build: fix 'NULL pointer dereference' errors Peng Tao
2013-11-14 16:32 ` [PATCH 32/39] staging/lustre/clio: honor O_NOATIME Peng Tao
2013-11-14 16:32 ` [PATCH 33/39] staging/lustre/llite: return compatible fsid for statfs Peng Tao
2013-11-14 16:32 ` [PATCH 34/39] staging/lustre/llite: cancel open lock before closing file Peng Tao
2013-11-14 16:32 ` [PATCH 35/39] staging/lustre/hsm: Add support to drop all pages for ll_data_version Peng Tao
2013-11-14 16:32 ` [PATCH 36/39] staging/lustre/build: fix 'no effect' errors Peng Tao
2013-11-14 16:33 ` [PATCH 37/39] staging/lustre/obd: add md_stats to MDC and LMV devices Peng Tao
2013-11-14 16:33 ` [PATCH 38/39] staging/lustre/autoconf: remove LC_SECURITY_PLUG test Peng Tao
2013-11-14 16:33 ` [PATCH 39/39] staging/lustre/osc: Lustre returns EINTR from writes when SA_RESTART is set Peng Tao

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