Skip to contentSkip to conversation

staging/lustre: patch bomb 2

PATCH In review Peng Tao 2 participants 42 messages Nov 14, 2013 – Nov 15, 2013 Staging

lore
Share & tools
lore

Peng Tao

author
#0 lore raw

cover staging/lustre: patch bomb 2

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 <[email protected]>

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
Signature · 1 line
1.7.9.5
author
#1 lore raw

PATCH 1/39 staging/lustre/hsm: remove hsm_nl proc file

From: "John L. Hammond" <[email protected]>

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

---
 drivers/staging/lustre/lustre/mdc/lproc_mdc.c |   73 -------------------------
 1 file changed, 73 deletions(-)
drivers/staging/lustre/lustre/mdc/lproc_mdc.c +0 -73
index e0b8f18..084f9a6 100644
@@ -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 }
 };
Signature · 1 line
1.7.9.5
#2 lore raw

Re: [PATCH 01/39] staging/lustre/hsm: remove hsm_nl proc file

Quoted 4 lines · Peng Tao

From: "John L. Hammond" <[email protected]>

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

author
#3 lore raw

Re: [PATCH 01/39] staging/lustre/hsm: remove hsm_nl proc file

Quoted 9 lines · Greg Kroah-Hartman
Quoted 4 lines · Peng Tao

From: "John L. Hammond" <[email protected]>

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

author
#4 lore raw

PATCH 2/39 staging/lustre/clio: wrong cl_lock usage

In reply to Peng Tao

From: Vitaly Fertman <[email protected]>

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

---
 drivers/staging/lustre/lustre/osc/osc_lock.c |   19 ++++++++++++-------
 1 file changed, 12 insertions(+), 7 deletions(-)
drivers/staging/lustre/lustre/osc/osc_lock.c +12 -7
index c90abfb..476b2e8 100644
@@ -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;
Signature · 1 line
1.7.9.5
author
#5 lore raw

PATCH 3/39 staging/lustre/build: fix 'deadcode' errors

In reply to Peng Tao

From: Sebastien Buisson <[email protected]>

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

---
 .../lustre/lustre/libcfs/linux/linux-curproc.c     |    4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/staging/lustre/lustre/libcfs/linux/linux-curproc.c +1 -3
index a2ef64c..e0f2f79 100644
@@ -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);
Signature · 1 line
1.7.9.5
author
#6 lore raw

PATCH 4/39 staging/lustre/build: fix 'integer handling' issues

In reply to Peng Tao

From: Sebastien Buisson <[email protected]>

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

---
 drivers/staging/lustre/lustre/llite/rw.c           |    1 -
 .../staging/lustre/lustre/obdclass/llog_ioctl.c    |    6 ++++--
 2 files changed, 4 insertions(+), 3 deletions(-)
drivers/staging/lustre/lustre/llite/rw.c +0 -1
index e9ba38a..112368f 100644
@@ -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);
 
drivers/staging/lustre/lustre/obdclass/llog_ioctl.c +4 -2
index da558a5..b6ad505 100644
@@ -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;
Signature · 1 line
1.7.9.5
author
#7 lore raw

PATCH 5/39 staging/lustre/ptlrpc: add rpc_cache

In reply to Peng Tao

From: Andriy Skulysh <[email protected]>

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

---
 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(-)
drivers/staging/lustre/lustre/ptlrpc/client.c +35 -7
index faa982a..9cdee5e 100644
@@ -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);
drivers/staging/lustre/lustre/ptlrpc/events.c +1 -1
index 58d089c..f5e0d31 100644
@@ -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",
drivers/staging/lustre/lustre/ptlrpc/ptlrpc_internal.h +4 -0
index ab36347..fa54c5a 100644
@@ -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 */
drivers/staging/lustre/lustre/ptlrpc/ptlrpc_module.c +16 -8
index 419e634..938aaed 100644
@@ -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();
 }
drivers/staging/lustre/lustre/ptlrpc/sec.c +3 -3
index 962b31d..7a10f73 100644
@@ -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);
 }
 
 /**************************************************
drivers/staging/lustre/lustre/ptlrpc/service.c +6 -7
index 21de868..abd0b8d 100644
@@ -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;
 }
 
Signature · 1 line
1.7.9.5
author
#8 lore raw

PATCH 6/39 staging/lustre/lnet: build Lustre with Intel OFED for Xeon Phi

In reply to Peng Tao

From: Dmitry Eremin <[email protected]>

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

---
 .../staging/lustre/lnet/klnds/o2iblnd/o2iblnd.h    |    2 ++
 1 file changed, 2 insertions(+)
drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.h +2 -0
index 938df0c..8cfd78b 100644
@@ -38,6 +38,7 @@
  * Author: Eric Barton <[email protected]>
  */
 
+#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>
Signature · 1 line
1.7.9.5
author
#9 lore raw

PATCH 7/39 staging/lustre/osd-ldiskfs: remove dependency on mdd module

In reply to Peng Tao

From: Andreas Dilger <[email protected]>

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

---
 .../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(-)
drivers/staging/lustre/lustre/include/lustre_capa.h +21 -4
index d77bffc..3d608ed 100644
@@ -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_ */
drivers/staging/lustre/lustre/include/md_object.h +0 -20
index 7b45b47..a25a5a3 100644
@@ -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 */
drivers/staging/lustre/lustre/obdclass/capa.c +41 -0

44 lines not on this page · raw message

drivers/staging/lustre/lustre/obdclass/class_obd.c +5 -0
index 4afd962..8d2c6a8 100644
@@ -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();
Signature · 1 line
1.7.9.5
author
#10 lore raw

PATCH 8/39 staging/lustre/libcfs: improve validity test for valid file descriptors

In reply to Peng Tao

From: Bob Glossman <[email protected]>

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

---
 .../include/linux/libcfs/libcfs_kernelcomm.h       |    1 +
 .../lustre/lustre/libcfs/kernel_user_comm.c        |   10 ++++++++--
 2 files changed, 9 insertions(+), 2 deletions(-)
drivers/staging/lustre/include/linux/libcfs/libcfs_kernelcomm.h +1 -0
index 596a15f..4e12ffc 100644
@@ -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 {
drivers/staging/lustre/lustre/libcfs/kernel_user_comm.c +8 -2
index 74a0db5..9e5e3cc 100644
@@ -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)
Signature · 1 line
1.7.9.5
author
#11 lore raw

PATCH 9/39 staging/lustre/llite: use 64bits flags in ll_lov_setea()

In reply to Peng Tao

From: Niu Yawei <[email protected]>

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

---
 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(-)
drivers/staging/lustre/lustre/llite/file.c +4 -3
index 02b297b..d3f375d 100644
@@ -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);
drivers/staging/lustre/lustre/llite/llite_internal.h +1 -1
index 37e33ab..69b5d91 100644
@@ -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,
drivers/staging/lustre/lustre/llite/xattr.c +3 -3
index 8c96854..b6cb0db 100644
@@ -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;
Signature · 1 line
1.7.9.5
author
#12 lore raw

PATCH 10/39 staging/lustre/hsm: small fixes for HSM

In reply to Peng Tao

From: Jinshan Xiong <[email protected]>

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

---
 .../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(-)
drivers/staging/lustre/include/linux/libcfs/libcfs_debug.h +69 -60
index 40282b7..02a77de 100644
@@ -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)
 
drivers/staging/lustre/lustre/libcfs/debug.c +12 -119

144 lines not on this page · raw message

drivers/staging/lustre/lustre/llite/dir.c +5 -0
index 1b217c8..044aa095 100644
@@ -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;
drivers/staging/lustre/lustre/llite/file.c +2 -2
index d3f375d..04dc9ce 100644
@@ -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);
drivers/staging/lustre/lustre/mdc/mdc_lib.c +1 -1
index 91f6876..a839c96 100644
@@ -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);
 
Signature · 1 line
1.7.9.5
author
#13 lore raw

PATCH 11/39 staging/lustre/mdt: CDT cleanup follow-on patch

In reply to Peng Tao

From: JC Lafoucriere <[email protected]>

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

---
 .../lustre/lustre/include/lustre/lustre_user.h     |    4 ++--
 drivers/staging/lustre/lustre/mdc/mdc_request.c    |    2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)
drivers/staging/lustre/lustre/include/lustre/lustre_user.h +2 -2
index c63a1ae..2c72a88 100644
@@ -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);
 
drivers/staging/lustre/lustre/mdc/mdc_request.c +1 -1
index e418b58..eb3b44f 100644
@@ -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);
 }
Signature · 1 line
1.7.9.5
author
#14 lore raw

PATCH 12/39 staging/lustre/utils: Posix copytool fixes.

In reply to Peng Tao

From: Henri Doreau <[email protected]>

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

---
 .../lustre/lustre/include/lustre/lustreapi.h       |    7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/staging/lustre/lustre/include/lustre/lustreapi.h +4 -3
index 0bb3c9f..e6ce238 100644
@@ -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,
Signature · 1 line
1.7.9.5
author
#15 lore raw

PATCH 13/39 staging/lustre/lmv: update coding style

In reply to Peng Tao

From: JC Lafoucriere <[email protected]>

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

---
 drivers/staging/lustre/lustre/lmv/lmv_obd.c |   42 +++++++++++++--------------
 1 file changed, 21 insertions(+), 21 deletions(-)
drivers/staging/lustre/lustre/lmv/lmv_obd.c +21 -21
index c286604..9d36014 100644
@@ -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);
Signature · 1 line
1.7.9.5
author
#16 lore raw

PATCH 14/39 staging/lustre/hsm: copy start error should set HP_FLAG_COMPLETED

In reply to Peng Tao

From: Aurelien Degremont <[email protected]>

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

---
 drivers/staging/lustre/lustre/llite/dir.c |    3 +++
 1 file changed, 3 insertions(+)
drivers/staging/lustre/lustre/llite/dir.c +3 -0
index 044aa095..f52c624 100644
@@ -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);
 
Signature · 1 line
1.7.9.5
author
#17 lore raw

PATCH 15/39 staging/lustre/lov: Get the correct address of lmm_objects

In reply to Peng Tao

From: Swapnil Pimpale <[email protected]>

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

---
 drivers/staging/lustre/lustre/lov/lov_pack.c |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/staging/lustre/lustre/lov/lov_pack.c +1 -2
index 27ed27e..102a34d 100644
@@ -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));
Signature · 1 line
1.7.9.5
author
#18 lore raw

PATCH 16/39 staging/lustre/lvfs: remove llog_lvfs.c and other lvfs code from llog

In reply to Peng Tao

From: James Simmons <[email protected]>

- 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

---
 .../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
drivers/staging/lustre/lustre/include/linux/lustre_fsfilt.h +0 -84
index 4da6e372..b250cce 100644
@@ -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
drivers/staging/lustre/lustre/include/linux/lvfs.h +0 -5
index e61f1b8..2080508 100644
@@ -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
drivers/staging/lustre/lustre/include/lustre_log.h +0 -4
index 896c757..d45a27f 100644
@@ -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,
drivers/staging/lustre/lustre/include/obd_class.h +0 -10
index 1c2ba19..8cb7cdf 100644
@@ -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. */
drivers/staging/lustre/lustre/lvfs/fsfilt_ext3.c deleted +0 -760

760 lines not on this page · raw message

drivers/staging/lustre/lustre/obdclass/llog_cat.c +13 -21
index c0f3af7..c813a88 100644
@@ -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);
drivers/staging/lustre/lustre/obdclass/llog_lvfs.c deleted +0 -847

847 lines not on this page · raw message

Signature · 1 line
1.7.9.5
author
#19 lore raw

PATCH 17/39 staging/lustre/llite: reset writeback index in ll_writepages

In reply to Peng Tao

From: Jinshan Xiong <[email protected]>

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

---
 drivers/staging/lustre/lustre/llite/rw.c      |    5 ++--
 drivers/staging/lustre/lustre/osc/osc_cache.c |   32 +++++++++++++++++--------
 2 files changed, 25 insertions(+), 12 deletions(-)
drivers/staging/lustre/lustre/llite/rw.c +3 -2
index 112368f..9fe12d3 100644
@@ -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;
 }
drivers/staging/lustre/lustre/osc/osc_cache.c +22 -10
index 00295da..7d63a37 100644
@@ -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;
 }
 
Signature · 1 line
1.7.9.5
author
#20 lore raw

PATCH 18/39 staging/lustre/llite: Delaying creation of client side proc entries.

In reply to Peng Tao

From: Gaurav Mahajan <[email protected]>

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

---
 drivers/staging/lustre/lustre/llite/llite_lib.c |   17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)
drivers/staging/lustre/lustre/llite/llite_lib.c +9 -8
index 18e3db2..a64808c 100644
@@ -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;
 }
 
Signature · 1 line
1.7.9.5
author
#21 lore raw

PATCH 19/39 staging/lustre/libcfs: Add relocation function to libcfs heap

In reply to Peng Tao

From: Li Xi <[email protected]>

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

---
 .../lustre/include/linux/libcfs/libcfs_heap.h      |    1 +
 drivers/staging/lustre/lustre/libcfs/heap.c        |   18 ++++++++++++++++--
 2 files changed, 17 insertions(+), 2 deletions(-)
drivers/staging/lustre/include/linux/libcfs/libcfs_heap.h +1 -0
index bfa6d7b..9d72647 100644
@@ -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)
drivers/staging/lustre/lustre/libcfs/heap.c +16 -2
index 147e4fe..2493582 100644
@@ -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 */
Signature · 1 line
1.7.9.5
author
#22 lore raw

PATCH 20/39 staging/lustre/build: fix 'data race condition' issues

In reply to Peng Tao

From: Sebastien Buisson <[email protected]>

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

---
 drivers/staging/lustre/lnet/selftest/conrpc.c |    8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/staging/lustre/lnet/selftest/conrpc.c +6 -2
index 4d48c77..d600823 100644
@@ -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) {
Signature · 1 line
1.7.9.5
author
#23 lore raw

PATCH 21/39 staging/lustre/autoconf: remove LC_LOCK_MAP_ACQUIRE test

In reply to Peng Tao

From: James Simmons <[email protected]>

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

---
 drivers/staging/lustre/lustre/obdclass/cl_lock.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/lustre/lustre/obdclass/cl_lock.c +1 -1
index 749eb08..828d492 100644
@@ -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 */
Signature · 1 line
1.7.9.5
author
#24 lore raw

PATCH 22/39 staging/lustre/mdc: document mdc_rpc_lock

In reply to Peng Tao

From: Ned Bass <[email protected]>

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

---
 drivers/staging/lustre/lustre/include/lustre_mdc.h |   18 ++++++++++++++++++
 1 file changed, 18 insertions(+)
drivers/staging/lustre/lustre/include/lustre_mdc.h +18 -0
index 1900025..3bb2f83 100644
@@ -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;
 };
 
Signature · 1 line
1.7.9.5
author
#25 lore raw

PATCH 23/39 staging/lustre/autoconf: remove LC_FS_STRUCT_USE_PATH

In reply to Peng Tao

From: James Simmons <[email protected]>

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

---
 .../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(-)
drivers/staging/lustre/lustre/include/linux/lustre_compat25.h +0 -5
index 2e1b7f1..8e1505a 100644
@@ -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
drivers/staging/lustre/lustre/lvfs/lvfs_linux.c +7 -7
index 1ef06fe..86b09a8 100644
@@ -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);
drivers/staging/lustre/lustre/ptlrpc/sec_config.c +1 -1
index 6cc3f23..6b4c971 100644
@@ -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);
Signature · 1 line
1.7.9.5
author
#26 lore raw

PATCH 24/39 staging/lustre/obdclass: fix wrong device put in case of race

In reply to Peng Tao

From: Mikhail Pershin <[email protected]>

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

---
 .../staging/lustre/lustre/obdclass/local_storage.c |   13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)
drivers/staging/lustre/lustre/obdclass/local_storage.c +8 -5
index 295bb7c..367d3fd 100644
@@ -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);
 }
Signature · 1 line
1.7.9.5
author
#27 lore raw

PATCH 25/39 staging/lustre/lmv: choose right MDT for open by FID

In reply to Peng Tao

From: wang di <[email protected]>

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

---
 drivers/staging/lustre/lustre/lmv/lmv_intent.c |    8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/staging/lustre/lustre/lmv/lmv_intent.c +7 -1
index 511b3b4..9d25fc4 100644
@@ -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);
 
Signature · 1 line
1.7.9.5
author
#28 lore raw

PATCH 26/39 staging/lustre/osd: remove fld lookup during configuration

In reply to Peng Tao

From: wang di <[email protected]>

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

---
 .../lustre/lustre/include/lustre/lustre_idl.h      |    7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/staging/lustre/lustre/include/lustre/lustre_idl.h +6 -1
index 7bdb24f..15f70dc 100644
@@ -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 */
Signature · 1 line
1.7.9.5
author
#29 lore raw

PATCH 27/39 staging/lustre/mdt: HSM EXIST event not triggered at last rm/mv

In reply to Peng Tao

From: JC Lafoucriere <[email protected]>

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

---
 .../lustre/lustre/include/lustre/lustre_user.h     |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/staging/lustre/lustre/include/lustre/lustre_user.h +4 -1
index 2c72a88..0ad524a 100644
@@ -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):
Signature · 1 line
1.7.9.5
author
#30 lore raw

PATCH 28/39 staging/lustre/ldlm: ldlm_flock_deadlock() ASSERTION( req != lock ) failed

In reply to Peng Tao

From: Andriy Skulysh <[email protected]>

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

---
 drivers/staging/lustre/lustre/ldlm/ldlm_flock.c |    3 +++
 1 file changed, 3 insertions(+)
drivers/staging/lustre/lustre/ldlm/ldlm_flock.c +3 -0
index 6324eff..d4598b6 100644
@@ -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;
Signature · 1 line
1.7.9.5
author
#31 lore raw

PATCH 29/39 staging/lustre/changelogs: Account for changelog_ext_rec in CR_MAXSIZE

In reply to Peng Tao

From: "Christopher J. Morrone" <[email protected]>

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

---
 .../lustre/lustre/include/lustre/lustre_user.h     |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/staging/lustre/lustre/include/lustre/lustre_user.h +2 -1
index 0ad524a..ffb56d7 100644
@@ -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;
Signature · 1 line
1.7.9.5
author
#32 lore raw

PATCH 30/39 staging/lustre/build: build error with gcc 4.7.0 20110509

In reply to Peng Tao

From: Dmitry Eremin <[email protected]>

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

---
 drivers/staging/lustre/lustre/lmv/lmv_obd.c |   50 +++++++++++++++------------
 1 file changed, 27 insertions(+), 23 deletions(-)
drivers/staging/lustre/lustre/lmv/lmv_obd.c +27 -23
index 9d36014..2587f1a 100644
@@ -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;
Signature · 1 line
1.7.9.5
author
#33 lore raw

PATCH 31/39 staging/lustre/build: fix 'NULL pointer dereference' errors

In reply to Peng Tao

From: Sebastien Buisson <[email protected]>

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

---
 .../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(-)
drivers/staging/lustre/lustre/include/lustre_update.h +2 -1
index 84defce..3f424af 100644
@@ -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);
 }
drivers/staging/lustre/lustre/llite/dir.c +12 -5
index f52c624..1856701 100644
@@ -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;
drivers/staging/lustre/lustre/lov/lov_io.c +2 -1
index 5a6ab70..cdd69232 100644
@@ -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
Signature · 1 line
1.7.9.5
author
#34 lore raw

PATCH 32/39 staging/lustre/clio: honor O_NOATIME

In reply to Peng Tao

From: "John L. Hammond" <[email protected]>

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

---
 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(-)
drivers/staging/lustre/lustre/include/cl_object.h +5 -1
index 4d692dc..76e1b68 100644
@@ -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.
 	 */
drivers/staging/lustre/lustre/llite/file.c +29 -0
index 04dc9ce..390bea5 100644
@@ -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
drivers/staging/lustre/lustre/lov/lov_io.c +1 -0
index cdd69232..0a32f98 100644
@@ -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,
drivers/staging/lustre/lustre/osc/osc_io.c +9 -12
index 681d60a..e567f2f 100644
@@ -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,
Signature · 1 line
1.7.9.5
author
#35 lore raw

PATCH 33/39 staging/lustre/llite: return compatible fsid for statfs

In reply to Peng Tao

From: Fan Yong <[email protected]>

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

---
 .../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(-)
drivers/staging/lustre/lustre/llite/llite_internal.h +0 -2
index 69b5d91..6148ec4 100644
@@ -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);
 
drivers/staging/lustre/lustre/llite/llite_lib.c +4 -4
index a64808c..a6e95bc 100644
@@ -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;
 }
 
drivers/staging/lustre/lustre/llite/llite_nfs.c +0 -16
index 3580069..d0948e0 100644
@@ -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,
Signature · 1 line
1.7.9.5
author
#36 lore raw

PATCH 34/39 staging/lustre/llite: cancel open lock before closing file

In reply to Peng Tao

From: Jinshan Xiong <[email protected]>

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

---
 drivers/staging/lustre/lustre/llite/file.c |   18 +++++++++++-------
 1 file changed, 11 insertions(+), 7 deletions(-)
drivers/staging/lustre/lustre/llite/file.c +11 -7
index 390bea5..a2a9844 100644
@@ -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);
Signature · 1 line
1.7.9.5
author
#37 lore raw

PATCH 35/39 staging/lustre/hsm: Add support to drop all pages for ll_data_version

In reply to Peng Tao

From: Jinshan Xiong <[email protected]>

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

---
 .../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(-)
drivers/staging/lustre/lustre/include/lustre/lustre_idl.h +1 -0
index 15f70dc..15ae8e8 100644
@@ -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. */
drivers/staging/lustre/lustre/include/lustre/lustre_user.h +2 -2
index ffb56d7..e982dbc 100644
@@ -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)))
drivers/staging/lustre/lustre/llite/dir.c +2 -3
index 1856701..00a782d 100644
@@ -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. "
drivers/staging/lustre/lustre/llite/file.c +22 -14
index a2a9844..9fa2cd6 100644
@@ -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;
drivers/staging/lustre/lustre/llite/llite_internal.h +1 -1
index 6148ec4..942601b 100644
@@ -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,
drivers/staging/lustre/lustre/lov/lov_merge.c +12 -1
index d204fed..fcfb1e5 100644
@@ -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! */
Signature · 1 line
1.7.9.5
author
#38 lore raw

PATCH 36/39 staging/lustre/build: fix 'no effect' errors

In reply to Peng Tao

From: Sebastien Buisson <[email protected]>

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

---
 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(-)
drivers/staging/lustre/lustre/llite/xattr.c +2 -3
index b6cb0db..b1384ff 100644
@@ -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));
 
drivers/staging/lustre/lustre/lmv/lmv_obd.c +1 -1
index 2587f1a..d3e7d6b 100644
@@ -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];
drivers/staging/lustre/lustre/lov/lov_obd.c +1 -1
index 4783450..b35a654 100644
@@ -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];
drivers/staging/lustre/lustre/ptlrpc/sec_bulk.c +0 -1
index 316103a..b9a3e6f 100644
@@ -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));
Signature · 1 line
1.7.9.5
author
#39 lore raw

PATCH 37/39 staging/lustre/obd: add md_stats to MDC and LMV devices

In reply to Peng Tao

From: "John L. Hammond" <[email protected]>

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

---
 .../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(-)
drivers/staging/lustre/lustre/include/lustre_export.h +0 -1
index 2feb38b..6db935e 100644
@@ -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 */
drivers/staging/lustre/lustre/include/obd.h +83 -56

224 lines not on this page · raw message

drivers/staging/lustre/lustre/include/obd_class.h +51 -68

145 lines not on this page · raw message

drivers/staging/lustre/lustre/llite/file.c +2 -2
index 9fa2cd6..60b3197 100644
@@ -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;
drivers/staging/lustre/lustre/lmv/lmv_obd.c +12 -9
index d3e7d6b..2a1d6e0 100644
@@ -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,
drivers/staging/lustre/lustre/lvfs/lvfs_lib.c +6 -0
index b21e40c..7579fa8 100644
@@ -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);
drivers/staging/lustre/lustre/mdc/mdc_request.c +5 -3
index eb3b44f..4c30fa8 100644
@@ -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,
drivers/staging/lustre/lustre/obdclass/lprocfs_status.c +39 -19

114 lines not on this page · raw message

Signature · 1 line
1.7.9.5
author
#40 lore raw

PATCH 38/39 staging/lustre/autoconf: remove LC_SECURITY_PLUG test

In reply to Peng Tao

From: James Simmons <[email protected]>

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

---
 .../lustre/lustre/include/linux/lustre_compat25.h  |    9 ---------
 drivers/staging/lustre/lustre/lvfs/lvfs_linux.c    |    3 +--
 2 files changed, 1 insertion(+), 11 deletions(-)
drivers/staging/lustre/lustre/include/linux/lustre_compat25.h +0 -9
index 8e1505a..a8b6af1 100644
@@ -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))
 
drivers/staging/lustre/lustre/lvfs/lvfs_linux.c +1 -2
index 86b09a8..2ca3fc4 100644
@@ -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:
Signature · 1 line
1.7.9.5
author
#41 lore raw

PATCH 39/39 staging/lustre/osc: Lustre returns EINTR from writes when SA_RESTART is set

In reply to Peng Tao

From: James Simmons <[email protected]>

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

---
 drivers/staging/lustre/lustre/osc/osc_cache.c |   15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)
drivers/staging/lustre/lustre/osc/osc_cache.c +13 -2
index 7d63a37..abb4604 100644
@@ -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);
 		}
Signature · 1 line
1.7.9.5