ocfs2/acl: use 'ip_xattr_sem' to protect getting extended attribute
authorpiaojun <[email protected]>
Thu, 1 Feb 2018 00:14:59 +0000 (16:14 -0800)
committerLinus Torvalds <[email protected]>
Thu, 1 Feb 2018 01:18:35 +0000 (17:18 -0800)
commit16c8d569f5704a84164f30ff01b29879f3438065
treec775e1a2cdba767c6d66b054eccbcc131ad428c3
parentd22aa61549036c1dfb47c04c0766630b128efe40
ocfs2/acl: use 'ip_xattr_sem' to protect getting extended attribute

The race between *set_acl and *get_acl will cause getting incomplete
xattr data as below:

  processA                                    processB

  ocfs2_set_acl
    ocfs2_xattr_set
      __ocfs2_xattr_set_handle

                                              ocfs2_get_acl_nolock
                                                ocfs2_xattr_get_nolock:

processB may get incomplete xattr data if processA hasn't set_acl done.

So we should use 'ip_xattr_sem' to protect getting extended attribute in
ocfs2_get_acl_nolock(), as other processes could be changing it
concurrently.

Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Jun Piao <[email protected]>
Reviewed-by: Alex Chen <[email protected]>
Cc: Mark Fasheh <[email protected]>
Cc: Joel Becker <[email protected]>
Cc: Junxiao Bi <[email protected]>
Cc: Joseph Qi <[email protected]>
Cc: Changwei Ge <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
fs/ocfs2/acl.c
fs/ocfs2/xattr.c