mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 11:11:45 -04:00
nbd: show read-only state in sysfs
Pass the read-only flag to set_device_ro, so that it will be visible to the block layer and in sysfs. Signed-off-by: Paolo Bonzini <[email protected]> Cc: Paul Clements <[email protected]> Cc: Alex Bligh <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
This commit is contained in:
parent
3a2d63f879
commit
a83e814b5b
1 changed files with 3 additions and 0 deletions
|
|
@ -703,6 +703,8 @@ static int __nbd_ioctl(struct block_device *bdev, struct nbd_device *nbd,
|
|||
|
||||
mutex_unlock(&nbd->tx_lock);
|
||||
|
||||
if (nbd->flags & NBD_FLAG_READ_ONLY)
|
||||
set_device_ro(bdev, true);
|
||||
if (nbd->flags & NBD_FLAG_SEND_TRIM)
|
||||
queue_flag_set_unlocked(QUEUE_FLAG_DISCARD,
|
||||
nbd->disk->queue);
|
||||
|
|
@ -730,6 +732,7 @@ static int __nbd_ioctl(struct block_device *bdev, struct nbd_device *nbd,
|
|||
dev_warn(disk_to_dev(nbd->disk), "queue cleared\n");
|
||||
kill_bdev(bdev);
|
||||
queue_flag_clear_unlocked(QUEUE_FLAG_DISCARD, nbd->disk->queue);
|
||||
set_device_ro(bdev, false);
|
||||
if (file)
|
||||
fput(file);
|
||||
nbd->flags = 0;
|
||||
|
|
|
|||
Loading…
Reference in a new issue