<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel.git/drivers/md/md.c, branch linux-4.0.y</title>
<subtitle>Hosts the 0x221E linux distro kernel.
</subtitle>
<id>https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-4.0.y</id>
<link rel='self' href='https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-4.0.y'/>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/'/>
<updated>2015-06-23T00:03:35Z</updated>
<entry>
<title>md: don't return 0 from array_state_store</title>
<updated>2015-06-23T00:03:35Z</updated>
<author>
<name>NeilBrown</name>
</author>
<published>2015-06-12T09:46:44Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=4715a2ff078ecdf6b195bce7f5ea537e31a5e552'/>
<id>urn:sha1:4715a2ff078ecdf6b195bce7f5ea537e31a5e552</id>
<content type='text'>
commit c008f1d356277a5b7561040596a073d87e56b0c8 upstream.

Returning zero from a 'store' function is bad.
The return value should be either len length of the string
or an error.

So use 'len' if 'err' is zero.

Fixes: 6791875e2e53 ("md: make reconfig_mutex optional for writes to md sysfs files.")
Signed-off-by: NeilBrown &lt;neilb@suse.de&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>md: Close race when setting 'action' to 'idle'.</title>
<updated>2015-06-23T00:03:35Z</updated>
<author>
<name>NeilBrown</name>
</author>
<published>2015-06-12T09:51:27Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=ad48fa9ae00009037975d535245dc8a63e997e4f'/>
<id>urn:sha1:ad48fa9ae00009037975d535245dc8a63e997e4f</id>
<content type='text'>
commit 8e8e2518fceca407bb8fc2a6710d19d2e217892e upstream.

Checking -&gt;sync_thread without holding the mddev_lock()
isn't really safe, even after flushing the workqueue which
ensures md_start_sync() has been run.

While this code is waiting for the lock, md_check_recovery could reap
the thread itself, and then start another thread (e.g. recovery might
finish, then reshape starts).  When this thread gets the lock
md_start_sync() hasn't run so it doesn't get reaped, but
MD_RECOVERY_RUNNING gets cleared.  This allows two threads to start
which leads to confusion.

So don't both if MD_RECOVERY_RUNNING isn't set, but if it is do
the flush and the test and the reap all under the mddev_lock to
avoid any race with md_check_recovery.

Signed-off-by: NeilBrown &lt;neilb@suse.de&gt;
Fixes: 6791875e2e53 ("md: make reconfig_mutex optional for writes to md sysfs files.")
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>md: fix race when unfreezing sync_action</title>
<updated>2015-06-06T15:21:09Z</updated>
<author>
<name>NeilBrown</name>
</author>
<published>2015-05-28T07:53:29Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=c368845702b75c0febc8d54a0489d1e9505cc81d'/>
<id>urn:sha1:c368845702b75c0febc8d54a0489d1e9505cc81d</id>
<content type='text'>
commit 56ccc1125bc141cf63927eda7febff4216dea2d3 upstream.

A recent change removed the need for locking around writing
to "sync_action" (and various other places), but introduced a
subtle race.
When e.g. setting 'reshape' on a 'frozen' array, the 'frozen'
flag is cleared before 'reshape' is set, so the md thread can
get in and start trying recovery - which isn't wanted.

So instead of clearing MD_RECOVERY_FROZEN for any command
except 'frozen', only clear it when each specific command
is parsed.  This allows the handling of 'reshape' to clear
the bit while a lock is held.

Also remove some places where we set MD_RECOVERY_NEEDED,
as it is always set on non-error exit of the function.


Signed-off-by: NeilBrown &lt;neilb@suse.de&gt;
Fixes: 6791875e2e53 ("md: make reconfig_mutex optional for writes to md sysfs files.")
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>block: destroy bdi before blockdev is unregistered.</title>
<updated>2015-05-17T16:55:07Z</updated>
<author>
<name>NeilBrown</name>
</author>
<published>2015-04-27T04:12:22Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=a45c1c367c8d8dc4fd5ee6fb5f92454c6145710a'/>
<id>urn:sha1:a45c1c367c8d8dc4fd5ee6fb5f92454c6145710a</id>
<content type='text'>
commit 6cd18e711dd8075da9d78cfc1239f912ff28968a upstream.

Because of the peculiar way that md devices are created (automatically
when the device node is opened), a new device can be created and
registered immediately after the
	blk_unregister_region(disk_devt(disk), disk-&gt;minors);
call in del_gendisk().

Therefore it is important that all visible artifacts of the previous
device are removed before this call.  In particular, the 'bdi'.

Since:
commit c4db59d31e39ea067c32163ac961e9c80198fd37
Author: Christoph Hellwig &lt;hch@lst.de&gt;
    fs: don't reassign dirty inodes to default_backing_dev_info

moved the
   device_unregister(bdi-&gt;dev);
call from bdi_unregister() to bdi_destroy() it has been quite easy to
lose a race and have a new (e.g.) "md127" be created after the
blk_unregister_region() call and before bdi_destroy() is ultimately
called by the final 'put_disk', which must come after del_gendisk().

The new device finds that the bdi name is already registered in sysfs
and complains

&gt; [ 9627.630029] WARNING: CPU: 18 PID: 3330 at fs/sysfs/dir.c:31 sysfs_warn_dup+0x5a/0x70()
&gt; [ 9627.630032] sysfs: cannot create duplicate filename '/devices/virtual/bdi/9:127'

We can fix this by moving the bdi_destroy() call out of
blk_release_queue() (which can happen very late when a refcount
reaches zero) and into blk_cleanup_queue() - which happens exactly when the md
device driver calls it.

Then it is only necessary for md to call blk_cleanup_queue() before
del_gendisk().  As loop.c devices are also created on demand by
opening the device node, we make the same change there.

Fixes: c4db59d31e39ea067c32163ac961e9c80198fd37
Reported-by: Azat Khuzhin &lt;a3at.mail@gmail.com&gt;
Cc: Christoph Hellwig &lt;hch@lst.de&gt;
Signed-off-by: NeilBrown &lt;neilb@suse.de&gt;
Reviewed-by: Christoph Hellwig &lt;hch@lst.de&gt;
Signed-off-by: Jens Axboe &lt;axboe@fb.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>md: fix md io stats accounting broken</title>
<updated>2015-05-06T20:03:36Z</updated>
<author>
<name>Gu Zheng</name>
</author>
<published>2015-04-03T00:44:47Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=8336ee9076303fbdb38e89f18e921ec238d9c48c'/>
<id>urn:sha1:8336ee9076303fbdb38e89f18e921ec238d9c48c</id>
<content type='text'>
commit 74672d069b298b03e9f657fd70915e055739882e upstream.

Simon reported the md io stats accounting issue:
"
I'm seeing "iostat -x -k 1" print this after a RAID1 rebuild on 4.0-rc5.
It's not abnormal other than it's 3-disk, with one being SSD (sdc) and
the other two being write-mostly:

Device:         rrqm/s   wrqm/s     r/s     w/s    rkB/s    wkB/s avgrq-sz avgqu-sz   await r_await w_await  svctm  %util
sda               0.00     0.00    0.00    0.00     0.00     0.00     0.00     0.00    0.00    0.00    0.00   0.00   0.00
sdb               0.00     0.00    0.00    0.00     0.00     0.00     0.00     0.00    0.00    0.00    0.00   0.00   0.00
sdc               0.00     0.00    0.00    0.00     0.00     0.00     0.00     0.00    0.00    0.00    0.00   0.00   0.00
md0               0.00     0.00    0.00    0.00     0.00     0.00     0.00   345.00    0.00    0.00    0.00   0.00 100.00
md2               0.00     0.00    0.00    0.00     0.00     0.00     0.00 58779.00    0.00    0.00    0.00   0.00 100.00
md1               0.00     0.00    0.00    0.00     0.00     0.00     0.00    12.00    0.00    0.00    0.00   0.00 100.00
"
The cause is commit "18c0b223cf9901727ef3b02da6711ac930b4e5d4" uses the
generic_start_io_acct to account the disk stats rather than the open code,
but it also introduced the increase to .in_flight[rw] which is needless to
md. So we re-use the open code here to fix it.

Reported-by: Simon Kirby &lt;sim@hostway.ca&gt;
Signed-off-by: Gu Zheng &lt;guz.fnst@cn.fujitsu.com&gt;
Signed-off-by: NeilBrown &lt;neilb@suse.de&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>md: fix problems with freeing private data after -&gt;run failure.</title>
<updated>2015-03-20T22:40:36Z</updated>
<author>
<name>NeilBrown</name>
</author>
<published>2015-03-13T00:51:18Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=0c35bd4723e4a39ba2da4c13a22cb97986ee10c8'/>
<id>urn:sha1:0c35bd4723e4a39ba2da4c13a22cb97986ee10c8</id>
<content type='text'>
If -&gt;run() fails, it can either free the data structures it
allocated, or leave that task to -&gt;free() which will be called
on failures.

However:
  md.c calls -&gt;free() even if -&gt;private_data is NULL, which
     causes problems in some personalities.
  raid0.c frees the data, but doesn't clear -&gt;private_data,
     which will become a problem when we fix md.c

So better fix both these issues at once.

Reported-by: Richard W.M. Jones &lt;rjones@redhat.com&gt;
Fixes: 5aa61f427e4979be733e4847b9199ff9cc48a47e
URL: https://bugzilla.kernel.org/show_bug.cgi?id=94381
Signed-off-by: NeilBrown &lt;neilb@suse.de&gt;
</content>
</entry>
<entry>
<title>md: mark some attributes as pre-alloc</title>
<updated>2015-02-25T00:38:46Z</updated>
<author>
<name>NeilBrown</name>
</author>
<published>2014-09-29T22:53:05Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=750f199ee8b578062341e6ddfe36c59ac8ff2dcb'/>
<id>urn:sha1:750f199ee8b578062341e6ddfe36c59ac8ff2dcb</id>
<content type='text'>
Since __ATTR_PREALLOC was introduced in v3.19-rc1~78^2~18
it can now be used by md.

This ensure that writing to these sysfs attributes will never
block due to a memory allocation.
Such blocking could become a deadlock if mdmon is trying to
reconfigure an array after a failure prior to re-enabling writes.

Signed-off-by: NeilBrown &lt;neilb@suse.de&gt;
</content>
</entry>
<entry>
<title>md: make reconfig_mutex optional for writes to md sysfs files.</title>
<updated>2015-02-05T22:32:56Z</updated>
<author>
<name>NeilBrown</name>
</author>
<published>2014-12-15T01:57:01Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=6791875e2e5393845b9c781d2998481089735134'/>
<id>urn:sha1:6791875e2e5393845b9c781d2998481089735134</id>
<content type='text'>
Rather than using mddev_lock() to take the reconfig_mutex
when writing to any md sysfs file, we only take mddev_lock()
in the particular _store() functions that require it.
Admittedly this is most, but it isn't all.

This also allows us to remove special-case handling for new_dev_store
(in md_attr_store).

Signed-off-by: NeilBrown &lt;neilb@suse.de&gt;
</content>
</entry>
<entry>
<title>md: move mddev_lock and related to md.h</title>
<updated>2015-02-05T22:32:56Z</updated>
<author>
<name>NeilBrown</name>
</author>
<published>2014-12-15T01:57:01Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=5c47daf6e76f657d961a96d89f6419fde8eda557'/>
<id>urn:sha1:5c47daf6e76f657d961a96d89f6419fde8eda557</id>
<content type='text'>
The one which is not inline (mddev_unlock) gets EXPORTed.

This makes the locking available to personality modules so that it
doesn't have to be imposed upon them.

Signed-off-by: NeilBrown &lt;neilb@suse.de&gt;
</content>
</entry>
<entry>
<title>md: use mddev-&gt;lock to protect updates to resync_{min,max}.</title>
<updated>2015-02-05T22:32:56Z</updated>
<author>
<name>NeilBrown</name>
</author>
<published>2014-12-15T01:57:01Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=23da422b1951cb8dbcb7c3090057cb6d5ceedf49'/>
<id>urn:sha1:23da422b1951cb8dbcb7c3090057cb6d5ceedf49</id>
<content type='text'>
There are interdependencies between these two sysfs attributes
and whether a resync is currently running.

Rather than depending on reconfig_mutex to ensure no races when
testing these interdependencies are met, use the spinlock.
This will allow the mutex to be remove from protecting this
code in a subsequent patch.

Signed-off-by: NeilBrown &lt;neilb@suse.de&gt;
</content>
</entry>
</feed>
