Patch "block: return -EBUSY when there are open partitions in blkdev_reread_part" has been added to the 5.10-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    block: return -EBUSY when there are open partitions in blkdev_reread_part

to the 5.10-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     block-return-ebusy-when-there-are-open-partitions-in.patch
and it can be found in the queue-5.10 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 4f7eb1151883b50e358339016b0410ddb1f315b1
Author: Christoph Hellwig <hch@xxxxxx>
Date:   Wed Apr 21 18:05:02 2021 +0200

    block: return -EBUSY when there are open partitions in blkdev_reread_part
    
    [ Upstream commit 68e6582e8f2dc32fd2458b9926564faa1fb4560e ]
    
    The switch to go through blkdev_get_by_dev means we now ignore the
    return value from bdev_disk_changed in __blkdev_get.  Add a manual
    check to restore the old semantics.
    
    Fixes: 4601b4b130de ("block: reopen the device in blkdev_reread_part")
    Reported-by: Karel Zak <kzak@xxxxxxxxxx>
    Signed-off-by: Christoph Hellwig <hch@xxxxxx>
    Link: https://lore.kernel.org/r/20210421160502.447418-1-hch@xxxxxx
    Signed-off-by: Jens Axboe <axboe@xxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/block/ioctl.c b/block/ioctl.c
index 3be4d0e2a96c..ed240e170e14 100644
--- a/block/ioctl.c
+++ b/block/ioctl.c
@@ -98,6 +98,8 @@ static int blkdev_reread_part(struct block_device *bdev, fmode_t mode)
 		return -EINVAL;
 	if (!capable(CAP_SYS_ADMIN))
 		return -EACCES;
+	if (bdev->bd_part_count)
+		return -EBUSY;
 
 	/*
 	 * Reopen the device to revalidate the driver state and force a



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux