linux-raid.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Song Liu <song@kernel.org>
To: Li Feng <fengli@smartx.com>
Cc: Xiao Ni <xni@redhat.com>,
	"open list:SOFTWARE RAID (Multiple Disks) SUPPORT" 
	<linux-raid@vger.kernel.org>
Subject: Re: [PATCH V2 1/1] md: Need to update superblock after changing rdev sb_flags
Date: Wed, 13 Oct 2021 10:26:57 -0700	[thread overview]
Message-ID: <CAPhsuW6K0YbnoCf=zWxxR_bnde74tJAPfpwJZKtryao7GamDpg@mail.gmail.com> (raw)
In-Reply-To: <CAHckoCymOtJoDZF7khAUJr2VQ-p0Xyzh+WQm7FtUCDqHvP2iBg@mail.gmail.com>

On Wed, Oct 13, 2021 at 8:19 AM Li Feng <fengli@smartx.com> wrote:
>
> Looks good. Feel free to add:
>
> Reviewed-by: Li Feng <fengli@smartx.com>
>
>
> Xiao Ni <xni@redhat.com> 于2021年10月13日周三 下午10:59写道:
>
>
> >
> > It doesn't update rdev superblock flags to disk after changing these flags.
> > This patch does this job.
> >
> > Signed-off-by: Xiao Ni <xni@redhat.com>

I updated the commit log and applied it to md-next.

Thanks,
Song

> > ---
> > V2: calls md_update_sb directly
> > ---
> >  drivers/md/md.c | 11 ++++++++++-
> >  1 file changed, 10 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/md/md.c b/drivers/md/md.c
> > index 6c0c3d0..e89eb46 100644
> > --- a/drivers/md/md.c
> > +++ b/drivers/md/md.c
> > @@ -2976,7 +2976,11 @@ state_store(struct md_rdev *rdev, const char *buf, size_t len)
> >          *  -write_error - clears WriteErrorSeen
> >          *  {,-}failfast - set/clear FailFast
> >          */
> > +
> > +       struct mddev *mddev = rdev->mddev;
> >         int err = -EINVAL;
> > +       bool need_update_sb = false;
> > +
> >         if (cmd_match(buf, "faulty") && rdev->mddev->pers) {
> >                 md_error(rdev->mddev, rdev);
> >                 if (test_bit(Faulty, &rdev->flags))
> > @@ -2991,7 +2995,6 @@ state_store(struct md_rdev *rdev, const char *buf, size_t len)
> >                 if (rdev->raid_disk >= 0)
> >                         err = -EBUSY;
> >                 else {
> > -                       struct mddev *mddev = rdev->mddev;
> >                         err = 0;
> >                         if (mddev_is_clustered(mddev))
> >                                 err = md_cluster_ops->remove_disk(mddev, rdev);
> > @@ -3008,10 +3011,12 @@ state_store(struct md_rdev *rdev, const char *buf, size_t len)
> >         } else if (cmd_match(buf, "writemostly")) {
> >                 set_bit(WriteMostly, &rdev->flags);
> >                 mddev_create_serial_pool(rdev->mddev, rdev, false);
> > +               need_update_sb = true;
> >                 err = 0;
> >         } else if (cmd_match(buf, "-writemostly")) {
> >                 mddev_destroy_serial_pool(rdev->mddev, rdev, false);
> >                 clear_bit(WriteMostly, &rdev->flags);
> > +               need_update_sb = true;
> >                 err = 0;
> >         } else if (cmd_match(buf, "blocked")) {
> >                 set_bit(Blocked, &rdev->flags);
> > @@ -3037,9 +3042,11 @@ state_store(struct md_rdev *rdev, const char *buf, size_t len)
> >                 err = 0;
> >         } else if (cmd_match(buf, "failfast")) {
> >                 set_bit(FailFast, &rdev->flags);
> > +               need_update_sb = true;
> >                 err = 0;
> >         } else if (cmd_match(buf, "-failfast")) {
> >                 clear_bit(FailFast, &rdev->flags);
> > +               need_update_sb = true;
> >                 err = 0;
> >         } else if (cmd_match(buf, "-insync") && rdev->raid_disk >= 0 &&
> >                    !test_bit(Journal, &rdev->flags)) {
> > @@ -3118,6 +3125,8 @@ state_store(struct md_rdev *rdev, const char *buf, size_t len)
> >                 clear_bit(ExternalBbl, &rdev->flags);
> >                 err = 0;
> >         }
> > +       if (need_update_sb)
> > +               md_update_sb(mddev, 1);
> >         if (!err)
> >                 sysfs_notify_dirent_safe(rdev->sysfs_state);
> >         return err ? err : len;
> > --
> > 2.7.5
> >

      reply	other threads:[~2021-10-13 17:27 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-13 14:59 [PATCH V2 1/1] md: Need to update superblock after changing rdev sb_flags Xiao Ni
2021-10-13 15:19 ` Li Feng
2021-10-13 17:26   ` Song Liu [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAPhsuW6K0YbnoCf=zWxxR_bnde74tJAPfpwJZKtryao7GamDpg@mail.gmail.com' \
    --to=song@kernel.org \
    --cc=fengli@smartx.com \
    --cc=linux-raid@vger.kernel.org \
    --cc=xni@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).