All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] [mdadm] fix bug in assemble
@ 2015-12-08  1:08 Song Liu
  2015-12-08  1:11 ` Song Liu
  2015-12-08 20:38 ` NeilBrown
  0 siblings, 2 replies; 3+ messages in thread
From: Song Liu @ 2015-12-08  1:08 UTC (permalink / raw)
  To: linux-raid; +Cc: neilb, dan.j.williams, shli, hch, kernel-team, Song Liu

In Assemble, getinfo_super() over writes journal_clean, to same
correct journal clean, keep it in "journal_clean_tmp" before
getinfo_super().

Signed-off-by: Song Liu <songliubraving@fb.com>
Signed-off-by: Shaohua Li <shli@fb.com>
---
 Assemble.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/Assemble.c b/Assemble.c
index 6b9a6da..0ab5943 100644
--- a/Assemble.c
+++ b/Assemble.c
@@ -1302,6 +1302,7 @@ int Assemble(struct supertype *st, char *mddev,
 	int bestcnt = 0;
 	int devcnt;
 	unsigned int okcnt, sparecnt, rebuilding_cnt, replcnt, journalcnt;
+	int journal_clean_tmp = 0;
 	int i;
 	int was_forced = 0;
 	int most_recent = 0;
@@ -1592,7 +1593,7 @@ try_again:
 			) {
 			devices[j].uptodate = 1;
 			if (devices[j].i.disk.state & (1<<MD_DISK_JOURNAL))
-				content->journal_clean = 1;
+				journal_clean_tmp = 1;  /* store in journal_clean_tmp */
 			if (i < content->array.raid_disks * 2) {
 				if (devices[j].i.recovery_start == MaxSector ||
 				    (content->reshape_active &&
@@ -1664,6 +1665,8 @@ try_again:
 #ifndef MDASSEMBLE
 	sysfs_init(content, mdfd, NULL);
 #endif
+	/* after reload context, store journal_clean in context */
+	content->journal_clean = journal_clean_tmp;
 	for (i=0; i<bestcnt; i++) {
 		int j = best[i];
 		unsigned int desired_state;
-- 
2.4.6


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

* RE: [PATCH 1/2] [mdadm] fix bug in assemble
  2015-12-08  1:08 [PATCH 1/2] [mdadm] fix bug in assemble Song Liu
@ 2015-12-08  1:11 ` Song Liu
  2015-12-08 20:38 ` NeilBrown
  1 sibling, 0 replies; 3+ messages in thread
From: Song Liu @ 2015-12-08  1:11 UTC (permalink / raw)
  To: Song Liu, linux-raid; +Cc: neilb, dan.j.williams, Shaohua Li, hch, Kernel Team

This is the only patch, not [1/2]. 

Thanks,
Song


> -----Original Message-----
> From: Song Liu [mailto:songliubraving@fb.com]
> Sent: Monday, December 7, 2015 5:09 PM
> To: linux-raid@vger.kernel.org
> Cc: neilb@suse.com; dan.j.williams@intel.com; Shaohua Li <shli@fb.com>;
> hch@infradead.org; Kernel Team <Kernel-team@fb.com>; Song Liu
> <songliubraving@fb.com>
> Subject: [PATCH 1/2] [mdadm] fix bug in assemble
> 
> In Assemble, getinfo_super() over writes journal_clean, to same correct journal
> clean, keep it in "journal_clean_tmp" before getinfo_super().
> 
> Signed-off-by: Song Liu <songliubraving@fb.com>
> Signed-off-by: Shaohua Li <shli@fb.com>
> ---
>  Assemble.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/Assemble.c b/Assemble.c
> index 6b9a6da..0ab5943 100644
> --- a/Assemble.c
> +++ b/Assemble.c
> @@ -1302,6 +1302,7 @@ int Assemble(struct supertype *st, char *mddev,
>  	int bestcnt = 0;
>  	int devcnt;
>  	unsigned int okcnt, sparecnt, rebuilding_cnt, replcnt, journalcnt;
> +	int journal_clean_tmp = 0;
>  	int i;
>  	int was_forced = 0;
>  	int most_recent = 0;
> @@ -1592,7 +1593,7 @@ try_again:
>  			) {
>  			devices[j].uptodate = 1;
>  			if (devices[j].i.disk.state & (1<<MD_DISK_JOURNAL))
> -				content->journal_clean = 1;
> +				journal_clean_tmp = 1;  /* store in
> journal_clean_tmp */
>  			if (i < content->array.raid_disks * 2) {
>  				if (devices[j].i.recovery_start == MaxSector ||
>  				    (content->reshape_active &&
> @@ -1664,6 +1665,8 @@ try_again:
>  #ifndef MDASSEMBLE
>  	sysfs_init(content, mdfd, NULL);
>  #endif
> +	/* after reload context, store journal_clean in context */
> +	content->journal_clean = journal_clean_tmp;
>  	for (i=0; i<bestcnt; i++) {
>  		int j = best[i];
>  		unsigned int desired_state;
> --
> 2.4.6


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

* Re: [PATCH 1/2] [mdadm] fix bug in assemble
  2015-12-08  1:08 [PATCH 1/2] [mdadm] fix bug in assemble Song Liu
  2015-12-08  1:11 ` Song Liu
@ 2015-12-08 20:38 ` NeilBrown
  1 sibling, 0 replies; 3+ messages in thread
From: NeilBrown @ 2015-12-08 20:38 UTC (permalink / raw)
  To: linux-raid; +Cc: dan.j.williams, shli, hch, kernel-team, Song Liu

[-- Attachment #1: Type: text/plain, Size: 1888 bytes --]

On Tue, Dec 08 2015, Song Liu wrote:

> In Assemble, getinfo_super() over writes journal_clean, to same
> correct journal clean, keep it in "journal_clean_tmp" before
> getinfo_super().

Change "same" to "save" (and a couple of other little improvements).
>
> Signed-off-by: Song Liu <songliubraving@fb.com>
> Signed-off-by: Shaohua Li <shli@fb.com>
> ---
>  Assemble.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/Assemble.c b/Assemble.c
> index 6b9a6da..0ab5943 100644
> --- a/Assemble.c
> +++ b/Assemble.c
> @@ -1302,6 +1302,7 @@ int Assemble(struct supertype *st, char *mddev,
>  	int bestcnt = 0;
>  	int devcnt;
>  	unsigned int okcnt, sparecnt, rebuilding_cnt, replcnt, journalcnt;
> +	int journal_clean_tmp = 0;

Removed "_tmp", it is just noise.


>  	int i;
>  	int was_forced = 0;
>  	int most_recent = 0;
> @@ -1592,7 +1593,7 @@ try_again:
>  			) {
>  			devices[j].uptodate = 1;
>  			if (devices[j].i.disk.state & (1<<MD_DISK_JOURNAL))
> -				content->journal_clean = 1;
> +				journal_clean_tmp = 1;  /* store in journal_clean_tmp */

 i++; /* increment i */
!!

I removed the comment.

Applied, thanks,
NeilBrown

>  			if (i < content->array.raid_disks * 2) {
>  				if (devices[j].i.recovery_start == MaxSector ||
>  				    (content->reshape_active &&
> @@ -1664,6 +1665,8 @@ try_again:
>  #ifndef MDASSEMBLE
>  	sysfs_init(content, mdfd, NULL);
>  #endif
> +	/* after reload context, store journal_clean in context */
> +	content->journal_clean = journal_clean_tmp;
>  	for (i=0; i<bestcnt; i++) {
>  		int j = best[i];
>  		unsigned int desired_state;
> -- 
> 2.4.6
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-raid" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 818 bytes --]

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

end of thread, other threads:[~2015-12-08 20:38 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-12-08  1:08 [PATCH 1/2] [mdadm] fix bug in assemble Song Liu
2015-12-08  1:11 ` Song Liu
2015-12-08 20:38 ` NeilBrown

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.