]> git.baikalelectronics.ru Git - kernel.git/commitdiff
fatfs: switch write_lock to read_lock in fat_ioctl_get_attributes
authorYubo Feng <fengyubo3@huawei.com>
Wed, 12 Aug 2020 01:35:56 +0000 (18:35 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Wed, 12 Aug 2020 17:58:01 +0000 (10:58 -0700)
There is no need to hold write_lock in fat_ioctl_get_attributes.
write_lock may make an impact on concurrency of fat_ioctl_get_attributes.

Signed-off-by: Yubo Feng <fengyubo3@huawei.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Acked-by: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
Link: http://lkml.kernel.org/r/1593308053-12702-1-git-send-email-fengyubo3@huawei.com
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
fs/fat/file.c

index 42134c58c87e19d1f6e77e888e3732bb4db10212..f9ee27cf4d7c2f678c67ba61f878d1494b315104 100644 (file)
@@ -25,9 +25,9 @@ static int fat_ioctl_get_attributes(struct inode *inode, u32 __user *user_attr)
 {
        u32 attr;
 
-       inode_lock(inode);
+       inode_lock_shared(inode);
        attr = fat_make_attrs(inode);
-       inode_unlock(inode);
+       inode_unlock_shared(inode);
 
        return put_user(attr, user_attr);
 }