All of lore.kernel.org
 help / color / mirror / Atom feed
* [Ocfs2-devel] [PATCH] ocfs2: Hold ip_lock when set/clear flags for indexed dir.
@ 2009-04-08 21:54 Tao Ma
  0 siblings, 0 replies; 4+ messages in thread
From: Tao Ma @ 2009-04-08 21:54 UTC (permalink / raw)
  To: ocfs2-devel

When we set/clear the dyn_features for an inode we hold the ip_lock.
So do it when we set/clear OCFS2_INDEXED_DIR_FL also.

Signed-off-by: Tao Ma <tao.ma@oracle.com>
---
 fs/ocfs2/dir.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/fs/ocfs2/dir.c b/fs/ocfs2/dir.c
index 07d8920..8e0f370 100644
--- a/fs/ocfs2/dir.c
+++ b/fs/ocfs2/dir.c
@@ -2463,8 +2463,10 @@ static int ocfs2_dx_dir_attach_index(struct ocfs2_super *osb,
 
 	di->i_dx_root = cpu_to_le64(dr_blkno);
 
+	spin_lock(&OCFS2_I(dir)->ip_lock);
 	OCFS2_I(dir)->ip_dyn_features |= OCFS2_INDEXED_DIR_FL;
 	di->i_dyn_features = cpu_to_le16(OCFS2_I(dir)->ip_dyn_features);
+	spin_unlock(&OCFS2_I(dir)->ip_lock);
 
 	ret = ocfs2_journal_dirty(handle, di_bh);
 	if (ret)
@@ -4477,8 +4479,10 @@ static int ocfs2_dx_dir_remove_index(struct inode *dir,
 		goto out_commit;
 	}
 
+	spin_lock(&OCFS2_I(dir)->ip_lock);
 	OCFS2_I(dir)->ip_dyn_features &= ~OCFS2_INDEXED_DIR_FL;
 	di->i_dyn_features = cpu_to_le16(OCFS2_I(dir)->ip_dyn_features);
+	spin_unlock(&OCFS2_I(dir)->ip_lock);
 	di->i_dx_root = cpu_to_le64(0ULL);
 
 	ocfs2_journal_dirty(handle, di_bh);
-- 
1.6.1.40.g8ea6a

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

* [Ocfs2-devel] [PATCH] ocfs2: Hold ip_lock when set/clear flags for indexed dir.
@ 2010-12-15  8:30 Tao Ma
  2010-12-15 20:26 ` Sunil Mushran
  2010-12-16  8:41 ` Joel Becker
  0 siblings, 2 replies; 4+ messages in thread
From: Tao Ma @ 2010-12-15  8:30 UTC (permalink / raw)
  To: ocfs2-devel

From: Tao Ma <boyu.mt@taobao.com>

When we set/clear the dyn_features for an inode we hold the ip_lock.
So do it when we set/clear OCFS2_INDEXED_DIR_FL also.

Signed-off-by: Tao Ma <boyu.mt@taobao.com>
---
 fs/ocfs2/dir.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/fs/ocfs2/dir.c b/fs/ocfs2/dir.c
index c49f6de..d417b3f 100644
--- a/fs/ocfs2/dir.c
+++ b/fs/ocfs2/dir.c
@@ -2461,8 +2461,10 @@ static int ocfs2_dx_dir_attach_index(struct ocfs2_super *osb,
 
 	di->i_dx_root = cpu_to_le64(dr_blkno);
 
+	spin_lock(&OCFS2_I(dir)->ip_lock);
 	OCFS2_I(dir)->ip_dyn_features |= OCFS2_INDEXED_DIR_FL;
 	di->i_dyn_features = cpu_to_le16(OCFS2_I(dir)->ip_dyn_features);
+	spin_unlock(&OCFS2_I(dir)->ip_lock);
 
 	ocfs2_journal_dirty(handle, di_bh);
 
@@ -4466,8 +4468,10 @@ static int ocfs2_dx_dir_remove_index(struct inode *dir,
 		goto out_commit;
 	}
 
+	spin_lock(&OCFS2_I(dir)->ip_lock);
 	OCFS2_I(dir)->ip_dyn_features &= ~OCFS2_INDEXED_DIR_FL;
 	di->i_dyn_features = cpu_to_le16(OCFS2_I(dir)->ip_dyn_features);
+	spin_unlock(&OCFS2_I(dir)->ip_lock);
 	di->i_dx_root = cpu_to_le64(0ULL);
 
 	ocfs2_journal_dirty(handle, di_bh);
-- 
1.7.0.4

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

* [Ocfs2-devel] [PATCH] ocfs2: Hold ip_lock when set/clear flags for indexed dir.
  2010-12-15  8:30 [Ocfs2-devel] [PATCH] ocfs2: Hold ip_lock when set/clear flags for indexed dir Tao Ma
@ 2010-12-15 20:26 ` Sunil Mushran
  2010-12-16  8:41 ` Joel Becker
  1 sibling, 0 replies; 4+ messages in thread
From: Sunil Mushran @ 2010-12-15 20:26 UTC (permalink / raw)
  To: ocfs2-devel

Acked-by Sunil Mushran <sunil.mushran@oracle.com>

On 12/15/2010 12:30 AM, Tao Ma wrote:
> From: Tao Ma<boyu.mt@taobao.com>
>
> When we set/clear the dyn_features for an inode we hold the ip_lock.
> So do it when we set/clear OCFS2_INDEXED_DIR_FL also.
>
> Signed-off-by: Tao Ma<boyu.mt@taobao.com>
> ---
>   fs/ocfs2/dir.c |    4 ++++
>   1 files changed, 4 insertions(+), 0 deletions(-)
>
> diff --git a/fs/ocfs2/dir.c b/fs/ocfs2/dir.c
> index c49f6de..d417b3f 100644
> --- a/fs/ocfs2/dir.c
> +++ b/fs/ocfs2/dir.c
> @@ -2461,8 +2461,10 @@ static int ocfs2_dx_dir_attach_index(struct ocfs2_super *osb,
>
>   	di->i_dx_root = cpu_to_le64(dr_blkno);
>
> +	spin_lock(&OCFS2_I(dir)->ip_lock);
>   	OCFS2_I(dir)->ip_dyn_features |= OCFS2_INDEXED_DIR_FL;
>   	di->i_dyn_features = cpu_to_le16(OCFS2_I(dir)->ip_dyn_features);
> +	spin_unlock(&OCFS2_I(dir)->ip_lock);
>
>   	ocfs2_journal_dirty(handle, di_bh);
>
> @@ -4466,8 +4468,10 @@ static int ocfs2_dx_dir_remove_index(struct inode *dir,
>   		goto out_commit;
>   	}
>
> +	spin_lock(&OCFS2_I(dir)->ip_lock);
>   	OCFS2_I(dir)->ip_dyn_features&= ~OCFS2_INDEXED_DIR_FL;
>   	di->i_dyn_features = cpu_to_le16(OCFS2_I(dir)->ip_dyn_features);
> +	spin_unlock(&OCFS2_I(dir)->ip_lock);
>   	di->i_dx_root = cpu_to_le64(0ULL);
>
>   	ocfs2_journal_dirty(handle, di_bh);

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

* [Ocfs2-devel] [PATCH] ocfs2: Hold ip_lock when set/clear flags for indexed dir.
  2010-12-15  8:30 [Ocfs2-devel] [PATCH] ocfs2: Hold ip_lock when set/clear flags for indexed dir Tao Ma
  2010-12-15 20:26 ` Sunil Mushran
@ 2010-12-16  8:41 ` Joel Becker
  1 sibling, 0 replies; 4+ messages in thread
From: Joel Becker @ 2010-12-16  8:41 UTC (permalink / raw)
  To: ocfs2-devel

On Wed, Dec 15, 2010 at 04:30:00PM +0800, Tao Ma wrote:
> From: Tao Ma <boyu.mt@taobao.com>
> 
> When we set/clear the dyn_features for an inode we hold the ip_lock.
> So do it when we set/clear OCFS2_INDEXED_DIR_FL also.
> 
> Signed-off-by: Tao Ma <boyu.mt@taobao.com>

This is now in the fixes branch of ocfs2.git.

Joel

> ---
>  fs/ocfs2/dir.c |    4 ++++
>  1 files changed, 4 insertions(+), 0 deletions(-)
> 
> diff --git a/fs/ocfs2/dir.c b/fs/ocfs2/dir.c
> index c49f6de..d417b3f 100644
> --- a/fs/ocfs2/dir.c
> +++ b/fs/ocfs2/dir.c
> @@ -2461,8 +2461,10 @@ static int ocfs2_dx_dir_attach_index(struct ocfs2_super *osb,
>  
>  	di->i_dx_root = cpu_to_le64(dr_blkno);
>  
> +	spin_lock(&OCFS2_I(dir)->ip_lock);
>  	OCFS2_I(dir)->ip_dyn_features |= OCFS2_INDEXED_DIR_FL;
>  	di->i_dyn_features = cpu_to_le16(OCFS2_I(dir)->ip_dyn_features);
> +	spin_unlock(&OCFS2_I(dir)->ip_lock);
>  
>  	ocfs2_journal_dirty(handle, di_bh);
>  
> @@ -4466,8 +4468,10 @@ static int ocfs2_dx_dir_remove_index(struct inode *dir,
>  		goto out_commit;
>  	}
>  
> +	spin_lock(&OCFS2_I(dir)->ip_lock);
>  	OCFS2_I(dir)->ip_dyn_features &= ~OCFS2_INDEXED_DIR_FL;
>  	di->i_dyn_features = cpu_to_le16(OCFS2_I(dir)->ip_dyn_features);
> +	spin_unlock(&OCFS2_I(dir)->ip_lock);
>  	di->i_dx_root = cpu_to_le64(0ULL);
>  
>  	ocfs2_journal_dirty(handle, di_bh);
> -- 
> 1.7.0.4
> 

-- 

"Here's something to think about:  How come you never see a headline
 like ``Psychic Wins Lottery''?"
	- Jay Leno

Joel Becker
Senior Development Manager
Oracle
E-mail: joel.becker at oracle.com
Phone: (650) 506-8127

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

end of thread, other threads:[~2010-12-16  8:41 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-12-15  8:30 [Ocfs2-devel] [PATCH] ocfs2: Hold ip_lock when set/clear flags for indexed dir Tao Ma
2010-12-15 20:26 ` Sunil Mushran
2010-12-16  8:41 ` Joel Becker
  -- strict thread matches above, loose matches on Subject: below --
2009-04-08 21:54 Tao Ma

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.