Re: [PATCH 1/1] docs/vfs: update references to i_mutex to i_rwsem

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun 15-06-25 21:16:53, Junxuan Liao wrote:
> VFS has switched to i_rwsem for ten years now (9902af79c01a: parallel
> lookups actual switch to rwsem), but the VFS documentation and comments
> still has references to i_mutex.
> 
> Signed-off-by: Junxuan Liao <ljx@xxxxxxxxxxx>

Thanks. This cleanup is long overdue :).

> diff --git a/Documentation/filesystems/vfs.rst b/Documentation/filesystems/vfs.rst
> index fd32a9a17bfb..a09c4aab9b5b 100644
> --- a/Documentation/filesystems/vfs.rst
> +++ b/Documentation/filesystems/vfs.rst
> @@ -759,7 +759,7 @@ dirty_folio to write data into the address_space, and
>  writepages to writeback data to storage.
>  
>  Adding and removing pages to/from an address_space is protected by the
> -inode's i_mutex.
> +inode's i_rwsem.

It is not your fault but this sentence is not actually true. i_rwsem is
held exlusively when removing pages from an address space. However i_rwsem
is often not held at all when adding pages to an address space.
mapping->invalidate_lock is used for that.

> diff --git a/fs/attr.c b/fs/attr.c
> index 9caf63d20d03..3a3881d3147f 100644
> --- a/fs/attr.c
> +++ b/fs/attr.c
> @@ -230,7 +230,7 @@ EXPORT_SYMBOL(setattr_prepare);
>   * @inode:	the inode to be truncated
>   * @offset:	the new size to assign to the inode
>   *
> - * inode_newsize_ok must be called with i_mutex held.
> + * inode_newsize_ok must be called with i_rwsem held.

I guess we can add "exclusively" here.

Otherwise the changes look good to me.

								Honza
-- 
Jan Kara <jack@xxxxxxxx>
SUSE Labs, CR




[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [NTFS 3]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [NTFS 3]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux