ANDROID: sdcardfs: Remove unnecessary lock
authorDaniel Rosenberg <drosen@google.com>
Thu, 20 Jul 2017 00:16:43 +0000 (17:16 -0700)
committerStricted <info@stricted.net>
Thu, 11 Oct 2018 16:03:42 +0000 (18:03 +0200)
The mmap_sem lock does not appear to be protecting
anything, and has been removed in Samsung's more
recent versions of sdcardfs.

Signed-off-by: Daniel Rosenberg <drosen@google.com>
Change-Id: I76ff3e33002716b8384fc8be368028ed63dffe4e
Bug: 63785372

fs/sdcardfs/inode.c

index f4d6c08df9351c13302213d016f07b91d0e92a68..030210ac8e10d77dbeee32c8926f560f392de86e 100644 (file)
@@ -778,13 +778,9 @@ static int sdcardfs_setattr(struct vfsmount *mnt, struct dentry *dentry, struct
         * afterwards in the other cases: we fsstack_copy_inode_size from
         * the lower level.
         */
-       if (current->mm)
-               down_write(&current->mm->mmap_sem);
        if (ia->ia_valid & ATTR_SIZE) {
                err = inode_newsize_ok(&tmp, ia->ia_size);
                if (err) {
-                       if (current->mm)
-                               up_write(&current->mm->mmap_sem);
                        goto out;
                }
                truncate_setsize(inode, ia->ia_size);
@@ -807,8 +803,6 @@ static int sdcardfs_setattr(struct vfsmount *mnt, struct dentry *dentry, struct
        err = notify_change2(lower_mnt, lower_dentry, &lower_ia); /* note: lower_ia */
 
        mutex_unlock(&lower_dentry->d_inode->i_mutex);
-       if (current->mm)
-               up_write(&current->mm->mmap_sem);
        if (err)
                goto out;