Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1519211

[PATCH 22/35] staging: lustre: llite: clear dir stripe md in ll_iget

From James Simmons <jsimmons@infradead.org>
Newsgroups linux.kernel
Subject [PATCH 22/35] staging: lustre: llite: clear dir stripe md in ll_iget
Date 2016-11-10 18:40 +0100
Message-ID <sC1ur-MX-83@gated-at.bofh.it> (permalink)
References <sC1up-MX-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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

If ll_iget fails during inode initialization, especially
during striped directory lookup after creation failed,
then it should clear stripe MD before make_bad_inode(),
because make_bad_inode() will reset the i_mode, which
can cause ll_clear_inode() skip freeing those stripe MD.

Signed-off-by: wang di <di.wang@intel.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-7230
Reviewed-on: http://review.whamcloud.com/16677
Reviewed-by: James Simmons <uja.ornl@yahoo.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Signed-off-by: James Simmons <jsimmons@infradead.org>
---
 .../staging/lustre/lustre/llite/llite_internal.h   |    1 +
 drivers/staging/lustre/lustre/llite/llite_lib.c    |    2 +-
 drivers/staging/lustre/lustre/llite/namei.c        |   10 ++++++++++
 3 files changed, 12 insertions(+), 1 deletions(-)

diff --git a/drivers/staging/lustre/lustre/llite/llite_internal.h b/drivers/staging/lustre/lustre/llite/llite_internal.h
index f635efa..c0513bf 100644
--- a/drivers/staging/lustre/lustre/llite/llite_internal.h
+++ b/drivers/staging/lustre/lustre/llite/llite_internal.h
@@ -785,6 +785,7 @@ int ll_revalidate_it_finish(struct ptlrpc_request *request,
 void ll_put_super(struct super_block *sb);
 void ll_kill_super(struct super_block *sb);
 struct inode *ll_inode_from_resource_lock(struct ldlm_lock *lock);
+void ll_dir_clear_lsm_md(struct inode *inode);
 void ll_clear_inode(struct inode *inode);
 int ll_setattr_raw(struct dentry *dentry, struct iattr *attr, bool hsm_import);
 int ll_setattr(struct dentry *de, struct iattr *attr);
diff --git a/drivers/staging/lustre/lustre/llite/llite_lib.c b/drivers/staging/lustre/lustre/llite/llite_lib.c
index 609db9b..dcd9240 100644
--- a/drivers/staging/lustre/lustre/llite/llite_lib.c
+++ b/drivers/staging/lustre/lustre/llite/llite_lib.c
@@ -1058,7 +1058,7 @@ struct inode *ll_inode_from_resource_lock(struct ldlm_lock *lock)
 	return inode;
 }
 
-static void ll_dir_clear_lsm_md(struct inode *inode)
+void ll_dir_clear_lsm_md(struct inode *inode)
 {
 	struct ll_inode_info *lli = ll_i2info(inode);
 
diff --git a/drivers/staging/lustre/lustre/llite/namei.c b/drivers/staging/lustre/lustre/llite/namei.c
index 9ea43e1..b07079c 100644
--- a/drivers/staging/lustre/lustre/llite/namei.c
+++ b/drivers/staging/lustre/lustre/llite/namei.c
@@ -117,6 +117,14 @@ struct inode *ll_iget(struct super_block *sb, ino_t hash,
 			rc = cl_file_inode_init(inode, md);
 
 		if (rc) {
+			/*
+			 * Let's clear directory lsm here, otherwise
+			 * make_bad_inode() will reset the inode mode
+			 * to regular, then ll_clear_inode will not
+			 * be able to clear lsm_md
+			 */
+			if (S_ISDIR(inode->i_mode))
+				ll_dir_clear_lsm_md(inode);
 			make_bad_inode(inode);
 			unlock_new_inode(inode);
 			iput(inode);
@@ -129,6 +137,8 @@ struct inode *ll_iget(struct super_block *sb, ino_t hash,
 		CDEBUG(D_VFSTRACE, "got inode: "DFID"(%p): rc = %d\n",
 		       PFID(&md->body->mbo_fid1), inode, rc);
 		if (rc) {
+			if (S_ISDIR(inode->i_mode))
+				ll_dir_clear_lsm_md(inode);
 			iput(inode);
 			inode = ERR_PTR(rc);
 		}
-- 
1.7.1

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 00/35] second batch of missing lustre 2.8 patches James Simmons <jsimmons@infradead.org> - 2016-11-10 18:40 +0100
  [PATCH 04/35] staging: lustre: lov: init LOV stripe type beforehand James Simmons <jsimmons@infradead.org> - 2016-11-10 18:40 +0100
  [PATCH 31/35] staging: lustre: obdclass: add export for lprocfs_stats_alloc_one() James Simmons <jsimmons@infradead.org> - 2016-11-10 18:40 +0100
  [PATCH 30/35] staging: lustre: llite: ll_write_begin/end not passing on errors James Simmons <jsimmons@infradead.org> - 2016-11-10 18:40 +0100
  [PATCH 14/35] staging: lustre: nrs: serialize executions of nrs_policy_stop James Simmons <jsimmons@infradead.org> - 2016-11-10 18:40 +0100
  [PATCH 19/35] staging: lustre: obdclass: remove structure holes to reduce memory James Simmons <jsimmons@infradead.org> - 2016-11-10 18:40 +0100
  [PATCH 15/35] staging: lustre: llite: tar restore fails for HSM released files. James Simmons <jsimmons@infradead.org> - 2016-11-10 18:40 +0100
  [PATCH 20/35] staging: lustre: ptlrpc: Move IT_* definitions to lustre_idl.h James Simmons <jsimmons@infradead.org> - 2016-11-10 18:40 +0100
  [PATCH 26/35] staging: lustre: mdc: remove console spew from mdc_ioc_fid2path James Simmons <jsimmons@infradead.org> - 2016-11-10 18:40 +0100
  [PATCH 35/35] staging: lustre: idl: clean up file attribute flags James Simmons <jsimmons@infradead.org> - 2016-11-10 18:40 +0100
  [PATCH 22/35] staging: lustre: llite: clear dir stripe md in ll_iget James Simmons <jsimmons@infradead.org> - 2016-11-10 18:40 +0100
  [PATCH 01/35] staging: lustre: hsm: Use file lease to implement migration James Simmons <jsimmons@infradead.org> - 2016-11-10 18:40 +0100
  [PATCH 10/35] staging: lustre: lmv: revalidate the dentry for striped dir James Simmons <jsimmons@infradead.org> - 2016-11-10 18:40 +0100
  [PATCH 28/35] staging: lustre: osc: Remove remains of osc_ast_guard James Simmons <jsimmons@infradead.org> - 2016-11-10 18:40 +0100
  [PATCH 03/35] staging: lustre: ptlrpc: mbits is sent within ptlrpc_body James Simmons <jsimmons@infradead.org> - 2016-11-10 18:40 +0100
  [PATCH 27/35] staging: lustre: ptlrpc: reset imp_replay_cursor James Simmons <jsimmons@infradead.org> - 2016-11-10 18:40 +0100
  [PATCH 25/35] staging: lustre: osc: Do not merge extents with partial pages James Simmons <jsimmons@infradead.org> - 2016-11-10 18:40 +0100
  [PATCH 16/35] staging: lustre: llite: support SELinux context labelling James Simmons <jsimmons@infradead.org> - 2016-11-10 18:50 +0100
  [PATCH 11/35] staging: lustre: ptlrpc: race at req processing James Simmons <jsimmons@infradead.org> - 2016-11-10 18:50 +0100
  [PATCH 06/35] staging: lustre: osc: Performance tune for LRU James Simmons <jsimmons@infradead.org> - 2016-11-10 18:50 +0100
  [PATCH 17/35] staging: lustre: obd: Remove dead code in precleanup James Simmons <jsimmons@infradead.org> - 2016-11-10 18:50 +0100
  [PATCH 13/35] staging: lustre: llite: lookup master inode by ilookup5_nowait James Simmons <jsimmons@infradead.org> - 2016-11-10 18:50 +0100
  [PATCH 18/35] staging: lustre: osc: fix max_dirty_mb tunable setting limit James Simmons <jsimmons@infradead.org> - 2016-11-10 18:50 +0100
  [PATCH 24/35] staging: lustre: osc: osc_extent should hold refcount to osc_object James Simmons <jsimmons@infradead.org> - 2016-11-10 18:50 +0100
  [PATCH 23/35] staging: lustre: ldlm: improve lock timeout messages James Simmons <jsimmons@infradead.org> - 2016-11-10 18:50 +0100
  [PATCH 05/35] staging: lustre: llog: fix wrong offset in llog_process_thread() James Simmons <jsimmons@infradead.org> - 2016-11-10 18:50 +0100
  [PATCH 02/35] staging: lustre: obd: rename obd_unpackmd() to md_unpackmd() James Simmons <jsimmons@infradead.org> - 2016-11-10 19:10 +0100
  [PATCH 07/35] staging: lustre: lov: avoid infinite loop in lsm_alloc_plain() James Simmons <jsimmons@infradead.org> - 2016-11-10 19:10 +0100
  [PATCH 09/35] staging: lustre: mgc: IR log failure should not stop mount James Simmons <jsimmons@infradead.org> - 2016-11-10 19:10 +0100

csiph-web