Skip to content

Commit 2acf045

Browse files
stellarhopperakpm00
authored andcommitted
dax/bus.c: use the right locking mode (read vs write) in size_show
In size_show(), the dax_dev_rwsem only needs a read lock, but was acquiring a write lock. Change it to down_read_interruptible() so it doesn't unnecessarily hold a write lock. Link: https://lkml.kernel.org/r/[email protected] Fixes: c05ae9d ("dax/bus.c: replace driver-core lock usage by a local rwsem") Signed-off-by: Vishal Verma <[email protected]> Reviewed-by: Dan Williams <[email protected]> Cc: Alison Schofield <[email protected]> Cc: Dave Jiang <[email protected]> Signed-off-by: Andrew Morton <[email protected]>
1 parent e39dbcf commit 2acf045

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/dax/bus.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -937,11 +937,11 @@ static ssize_t size_show(struct device *dev,
937937
unsigned long long size;
938938
int rc;
939939

940-
rc = down_write_killable(&dax_dev_rwsem);
940+
rc = down_read_interruptible(&dax_dev_rwsem);
941941
if (rc)
942942
return rc;
943943
size = dev_dax_size(dev_dax);
944-
up_write(&dax_dev_rwsem);
944+
up_read(&dax_dev_rwsem);
945945

946946
return sysfs_emit(buf, "%llu\n", size);
947947
}

0 commit comments

Comments
 (0)