Commit b5dea9c0 authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'block-5.10-2020-11-13' of git://git.kernel.dk/linux-block

Pull block fixes from Jens Axboe:
 "A few small fixes:

   - NVMe pull request from Christoph:
        - don't clear the read-only bit on a revalidate (Sagi Grimberg)

   - nbd error case refcount leak (Christoph)

   - loop/generic uevent fix (Christoph, Petr)"

* tag 'block-5.10-2020-11-13' of git://git.kernel.dk/linux-block:
  loop: Fix occasional uevent drop
  block: add a return value to set_capacity_revalidate_and_notify
  nbd: fix a block_device refcount leak in nbd_release
  nvme: fix incorrect behavior when BLKROSET is called by the user
parents 1b1e9262 c01a21b7
......@@ -49,7 +49,7 @@ static void disk_release_events(struct gendisk *disk);
* Set disk capacity and notify if the size is not currently
* zero and will not be set to zero
*/
void set_capacity_revalidate_and_notify(struct gendisk *disk, sector_t size,
bool set_capacity_revalidate_and_notify(struct gendisk *disk, sector_t size,
bool update_bdev)
{
sector_t capacity = get_capacity(disk);
......@@ -62,7 +62,10 @@ void set_capacity_revalidate_and_notify(struct gendisk *disk, sector_t size,
char *envp[] = { "RESIZE=1", NULL };
kobject_uevent_env(&disk_to_dev(disk)->kobj, KOBJ_CHANGE, envp);
return true;
}
return false;
}
EXPORT_SYMBOL_GPL(set_capacity_revalidate_and_notify);
......
......@@ -255,7 +255,8 @@ static void loop_set_size(struct loop_device *lo, loff_t size)
bd_set_nr_sectors(bdev, size);
set_capacity_revalidate_and_notify(lo->lo_disk, size, false);
if (!set_capacity_revalidate_and_notify(lo->lo_disk, size, false))
kobject_uevent(&disk_to_dev(bdev->bd_disk)->kobj, KOBJ_CHANGE);
}
static inline int
......
......@@ -1518,6 +1518,7 @@ static void nbd_release(struct gendisk *disk, fmode_t mode)
if (test_bit(NBD_RT_DISCONNECT_ON_CLOSE, &nbd->config->runtime_flags) &&
bdev->bd_openers == 0)
nbd_disconnect_and_put(nbd);
bdput(bdev);
nbd_config_put(nbd);
nbd_put(nbd);
......
......@@ -2060,8 +2060,6 @@ static void nvme_update_disk_info(struct gendisk *disk,
if (id->nsattr & NVME_NS_ATTR_RO)
set_disk_ro(disk, true);
else
set_disk_ro(disk, false);
}
static inline bool nvme_first_scan(struct gendisk *disk)
......
......@@ -315,7 +315,7 @@ static inline int get_disk_ro(struct gendisk *disk)
extern void disk_block_events(struct gendisk *disk);
extern void disk_unblock_events(struct gendisk *disk);
extern void disk_flush_events(struct gendisk *disk, unsigned int mask);
void set_capacity_revalidate_and_notify(struct gendisk *disk, sector_t size,
bool set_capacity_revalidate_and_notify(struct gendisk *disk, sector_t size,
bool update_bdev);
/* drivers/char/random.c */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment