summaryrefslogtreecommitdiffstats
path: root/drivers/dax/bus.c
diff options
context:
space:
mode:
authorVishal Verma <vishal.l.verma@intel.com>2024-04-30 19:44:26 +0200
committerAndrew Morton <akpm@linux-foundation.org>2024-05-07 19:37:01 +0200
commit2acf04532d6d655d8c3b2ee4ddeb320107043086 (patch)
tree65a9637e7ca07490d33b656ee3bd5f8f767cdc90 /drivers/dax/bus.c
parentdax/bus.c: don't use down_write_killable for non-user processes (diff)
downloadlinux-2acf04532d6d655d8c3b2ee4ddeb320107043086.tar.xz
linux-2acf04532d6d655d8c3b2ee4ddeb320107043086.zip
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/20240430-vv-dax_abi_fixes-v3-4-e3dcd755774c@intel.com Fixes: c05ae9d85b47 ("dax/bus.c: replace driver-core lock usage by a local rwsem") Signed-off-by: Vishal Verma <vishal.l.verma@intel.com> Reviewed-by: Dan Williams <dan.j.williams@intel.com> Cc: Alison Schofield <alison.schofield@intel.com> Cc: Dave Jiang <dave.jiang@intel.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Diffstat (limited to 'drivers/dax/bus.c')
-rw-r--r--drivers/dax/bus.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/dax/bus.c b/drivers/dax/bus.c
index 0011a6e6a8f2..f24b67c64d5e 100644
--- a/drivers/dax/bus.c
+++ b/drivers/dax/bus.c
@@ -937,11 +937,11 @@ static ssize_t size_show(struct device *dev,
unsigned long long size;
int rc;
- rc = down_write_killable(&dax_dev_rwsem);
+ rc = down_read_interruptible(&dax_dev_rwsem);
if (rc)
return rc;
size = dev_dax_size(dev_dax);
- up_write(&dax_dev_rwsem);
+ up_read(&dax_dev_rwsem);
return sysfs_emit(buf, "%llu\n", size);
}