aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md/md.c
diff options
context:
space:
mode:
authorBrian Norris <computersforpeace@gmail.com>2017-06-01 13:53:55 -0400
committerBrian Norris <computersforpeace@gmail.com>2017-06-01 13:53:55 -0400
commit05e97a9eda72d58dba293857df6aac62584ef99a (patch)
treee86e692f26d4879ff2210c54722e2b7780210249 /drivers/md/md.c
parent2ea659a9ef488125eb46da6eb571de5eae5c43f6 (diff)
parentd4ed3b9015b5eebc90d629579d9e7944607cbae5 (diff)
Merge tag 'nand/fixes-for-4.12-rc3' of git://git.infradead.org/linux-mtd into MTD
From Boris: """ This pull request contains several fixes to the core and the tango driver. tango fixes: * Add missing MODULE_DEVICE_TABLE() in tango_nand.c * Update the number of corrected bitflips core fixes: * Fix a long standing memory leak in nand_scan_tail() * Fix several bugs introduced by the per-vendor init/detection infrastructure (introduced in 4.12) * Add a static specifier to nand_ooblayout_lp_hamming_ops definition """
Diffstat (limited to 'drivers/md/md.c')
-rw-r--r--drivers/md/md.c20
1 files changed, 8 insertions, 12 deletions
diff --git a/drivers/md/md.c b/drivers/md/md.c
index 82f798be964f..10367ffe92e3 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -8022,18 +8022,15 @@ EXPORT_SYMBOL(md_write_end);
8022 * may proceed without blocking. It is important to call this before 8022 * may proceed without blocking. It is important to call this before
8023 * attempting a GFP_KERNEL allocation while holding the mddev lock. 8023 * attempting a GFP_KERNEL allocation while holding the mddev lock.
8024 * Must be called with mddev_lock held. 8024 * Must be called with mddev_lock held.
8025 *
8026 * In the ->external case MD_SB_CHANGE_PENDING can not be cleared until mddev->lock
8027 * is dropped, so return -EAGAIN after notifying userspace.
8028 */ 8025 */
8029int md_allow_write(struct mddev *mddev) 8026void md_allow_write(struct mddev *mddev)
8030{ 8027{
8031 if (!mddev->pers) 8028 if (!mddev->pers)
8032 return 0; 8029 return;
8033 if (mddev->ro) 8030 if (mddev->ro)
8034 return 0; 8031 return;
8035 if (!mddev->pers->sync_request) 8032 if (!mddev->pers->sync_request)
8036 return 0; 8033 return;
8037 8034
8038 spin_lock(&mddev->lock); 8035 spin_lock(&mddev->lock);
8039 if (mddev->in_sync) { 8036 if (mddev->in_sync) {
@@ -8046,13 +8043,12 @@ int md_allow_write(struct mddev *mddev)
8046 spin_unlock(&mddev->lock); 8043 spin_unlock(&mddev->lock);
8047 md_update_sb(mddev, 0); 8044 md_update_sb(mddev, 0);
8048 sysfs_notify_dirent_safe(mddev->sysfs_state); 8045 sysfs_notify_dirent_safe(mddev->sysfs_state);
8046 /* wait for the dirty state to be recorded in the metadata */
8047 wait_event(mddev->sb_wait,
8048 !test_bit(MD_SB_CHANGE_CLEAN, &mddev->sb_flags) &&
8049 !test_bit(MD_SB_CHANGE_PENDING, &mddev->sb_flags));
8049 } else 8050 } else
8050 spin_unlock(&mddev->lock); 8051 spin_unlock(&mddev->lock);
8051
8052 if (test_bit(MD_SB_CHANGE_PENDING, &mddev->sb_flags))
8053 return -EAGAIN;
8054 else
8055 return 0;
8056} 8052}
8057EXPORT_SYMBOL_GPL(md_allow_write); 8053EXPORT_SYMBOL_GPL(md_allow_write);
8058 8054