Skip to content

Commit df80b36

Browse files
committed
dax/bus.c: use the right locking mode (read vs write) in size_show
JIRA: https://issues.redhat.com/browse/RHEL-23824 commit 2acf045 Author: Vishal Verma <vishal.l.verma@intel.com> Date: Tue Apr 30 11:44:26 2024 -0600 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: c05ae9d ("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> Signed-off-by: Jeff Moyer <jmoyer@redhat.com>
1 parent 80101db commit df80b36

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
@@ -939,11 +939,11 @@ static ssize_t size_show(struct device *dev,
939939
unsigned long long size;
940940
int rc;
941941

942-
rc = down_write_killable(&dax_dev_rwsem);
942+
rc = down_read_interruptible(&dax_dev_rwsem);
943943
if (rc)
944944
return rc;
945945
size = dev_dax_size(dev_dax);
946-
up_write(&dax_dev_rwsem);
946+
up_read(&dax_dev_rwsem);
947947

948948
return sysfs_emit(buf, "%llu\n", size);
949949
}

0 commit comments

Comments
 (0)