<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux-toradex.git/fs/f2fs/acl.c, branch v4.5</title>
<subtitle>Linux kernel for Apalis and Colibri modules</subtitle>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/'/>
<entry>
<title>f2fs: make posix_acl_create() safer and cleaner</title>
<updated>2015-05-07T18:38:31+00:00</updated>
<author>
<name>Chao Yu</name>
<email>chao2.yu@samsung.com</email>
</author>
<published>2015-04-18T10:03:58+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=272e083f7a968bc81dd01e4f16860a1e9617d454'/>
<id>272e083f7a968bc81dd01e4f16860a1e9617d454</id>
<content type='text'>
Our f2fs_acl_create is copied from posix_acl_create in ./fs/posix_acl.c and
modified to avoid deadlock bug when inline_dentry feature is enabled.

Dan Carpenter rewrites posix_acl_create in commit 2799563b281f
("fs/posix_acl.c: make posix_acl_create() safer and cleaner") to make this
function more safer, so that we can avoid potential bug in its caller,
especially for ocfs2.

Let's back port the patch to f2fs.

Signed-off-by: Chao Yu &lt;chao2.yu@samsung.com&gt;
Signed-off-by: Jaegeuk Kim &lt;jaegeuk@kernel.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Our f2fs_acl_create is copied from posix_acl_create in ./fs/posix_acl.c and
modified to avoid deadlock bug when inline_dentry feature is enabled.

Dan Carpenter rewrites posix_acl_create in commit 2799563b281f
("fs/posix_acl.c: make posix_acl_create() safer and cleaner") to make this
function more safer, so that we can avoid potential bug in its caller,
especially for ocfs2.

Let's back port the patch to f2fs.

Signed-off-by: Chao Yu &lt;chao2.yu@samsung.com&gt;
Signed-off-by: Jaegeuk Kim &lt;jaegeuk@kernel.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>f2fs: fix reference leaks in f2fs_acl_create</title>
<updated>2015-04-10T22:08:40+00:00</updated>
<author>
<name>Chao Yu</name>
<email>chao2.yu@samsung.com</email>
</author>
<published>2015-03-09T10:18:19+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=83dfe53c185e3554c102708c70dc1e5ff4bcac2c'/>
<id>83dfe53c185e3554c102708c70dc1e5ff4bcac2c</id>
<content type='text'>
Our f2fs_acl_create is copied and modified from posix_acl_create to avoid
deadlock bug when inline_dentry feature is enabled.

Now, we got reference leaks in posix_acl_create, and this has been fixed in
commit fed0b588be2f ("posix_acl: fix reference leaks in posix_acl_create")
by Omar Sandoval.
https://lkml.org/lkml/2015/2/9/5

Let's fix this issue in f2fs_acl_create too.

Signed-off-by: Chao Yu &lt;chao2.yu@samsung.com&gt;
Reviewed-by: Changman Lee &lt;cm224.lee@ssamsung.com&gt;
Signed-off-by: Jaegeuk Kim &lt;jaegeuk@kernel.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Our f2fs_acl_create is copied and modified from posix_acl_create to avoid
deadlock bug when inline_dentry feature is enabled.

Now, we got reference leaks in posix_acl_create, and this has been fixed in
commit fed0b588be2f ("posix_acl: fix reference leaks in posix_acl_create")
by Omar Sandoval.
https://lkml.org/lkml/2015/2/9/5

Let's fix this issue in f2fs_acl_create too.

Signed-off-by: Chao Yu &lt;chao2.yu@samsung.com&gt;
Reviewed-by: Changman Lee &lt;cm224.lee@ssamsung.com&gt;
Signed-off-by: Jaegeuk Kim &lt;jaegeuk@kernel.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>f2fs: fix a bug of inheriting default ACL from parent</title>
<updated>2015-02-12T01:04:36+00:00</updated>
<author>
<name>Kinglong Mee</name>
<email>kinglongmee@gmail.com</email>
</author>
<published>2015-01-24T09:06:25+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=3b6709b771b3335856643df8f6e0158db150a438'/>
<id>3b6709b771b3335856643df8f6e0158db150a438</id>
<content type='text'>
Introduced by a6dda0e63e97122ce9e0ba04367e37cca28315fa
"f2fs: use generic posix ACL infrastructure".

When testing default acl, gets in recent kernel (3.19.0-rc5),
user::rwx
group::r-x
other::r-x
default:user::rwx
default:group::r-x
default:group:root:rwx
default:mask::rwx
default:other::r-x

]# getfacl testdir/
user::rwx
group::rwx
                // missing an acl "group:root:rwx" inherited from parent
other::r-x
default:user::rwx
default:group::r-x
default:group:root:rwx
default:mask::rwx
default:other::r-x

Signed-off-by: Kinglong Mee &lt;kinglongmee@gmail.com&gt;
Reviewed-by: Chao Yu &lt;chao2.yu@samsung.com&gt;
Signed-off-by: Jaegeuk Kim &lt;jaegeuk@kernel.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Introduced by a6dda0e63e97122ce9e0ba04367e37cca28315fa
"f2fs: use generic posix ACL infrastructure".

When testing default acl, gets in recent kernel (3.19.0-rc5),
user::rwx
group::r-x
other::r-x
default:user::rwx
default:group::r-x
default:group:root:rwx
default:mask::rwx
default:other::r-x

]# getfacl testdir/
user::rwx
group::rwx
                // missing an acl "group:root:rwx" inherited from parent
other::r-x
default:user::rwx
default:group::r-x
default:group:root:rwx
default:mask::rwx
default:other::r-x

Signed-off-by: Kinglong Mee &lt;kinglongmee@gmail.com&gt;
Reviewed-by: Chao Yu &lt;chao2.yu@samsung.com&gt;
Signed-off-by: Jaegeuk Kim &lt;jaegeuk@kernel.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>f2fs: avoid double lock for cp_rwsem</title>
<updated>2015-01-10T01:02:25+00:00</updated>
<author>
<name>Jaegeuk Kim</name>
<email>jaegeuk@kernel.org</email>
</author>
<published>2014-12-19T03:32:36+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=dd802406e396c22dfb5aa0d16196f04d515be49e'/>
<id>dd802406e396c22dfb5aa0d16196f04d515be49e</id>
<content type='text'>
The __f2fs_add_link is covered by cp_rwsem all the time.
This calls init_inode_metadata, which conducts some acl operations including
memory allocation with GFP_KERNEL previously.
But, under memory pressure, f2fs_write_data_page can be called, which also
grabs cp_rwsem too.

In this case, this incurs a deadlock pointed by Chao.
Thread #1        Thread #2
 down_read
                 down_write
  down_read
 -&gt; here down_read should wait forever.

Reviewed-by: Chao Yu &lt;chao2.yu@samsung.com&gt;
Signed-off-by: Jaegeuk Kim &lt;jaegeuk@kernel.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The __f2fs_add_link is covered by cp_rwsem all the time.
This calls init_inode_metadata, which conducts some acl operations including
memory allocation with GFP_KERNEL previously.
But, under memory pressure, f2fs_write_data_page can be called, which also
grabs cp_rwsem too.

In this case, this incurs a deadlock pointed by Chao.
Thread #1        Thread #2
 down_read
                 down_write
  down_read
 -&gt; here down_read should wait forever.

Reviewed-by: Chao Yu &lt;chao2.yu@samsung.com&gt;
Signed-off-by: Jaegeuk Kim &lt;jaegeuk@kernel.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>f2fs: remove the redundant function cond_clear_inode_flag</title>
<updated>2014-11-04T00:07:36+00:00</updated>
<author>
<name>Gu Zheng</name>
<email>guz.fnst@cn.fujitsu.com</email>
</author>
<published>2014-10-20T09:45:52+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=fa528722d06ecbee9d918b9eec58c5d4c2978839'/>
<id>fa528722d06ecbee9d918b9eec58c5d4c2978839</id>
<content type='text'>
Use clear_inode_flag to replace the redundant cond_clear_inode_flag.

Signed-off-by: Gu Zheng &lt;guz.fnst@cn.fujitsu.com&gt;
Signed-off-by: Jaegeuk Kim &lt;jaegeuk@kernel.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Use clear_inode_flag to replace the redundant cond_clear_inode_flag.

Signed-off-by: Gu Zheng &lt;guz.fnst@cn.fujitsu.com&gt;
Signed-off-by: Jaegeuk Kim &lt;jaegeuk@kernel.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>f2fs: avoid deadlock on init_inode_metadata</title>
<updated>2014-11-04T00:07:33+00:00</updated>
<author>
<name>Jaegeuk Kim</name>
<email>jaegeuk@kernel.org</email>
</author>
<published>2014-10-14T02:42:53+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=bce8d1120707c06088928b2ee52a58703d74ac29'/>
<id>bce8d1120707c06088928b2ee52a58703d74ac29</id>
<content type='text'>
Previously, init_inode_metadata does not hold any parent directory's inode
page. So, f2fs_init_acl can grab its parent inode page without any problem.
But, when we use inline_dentry, that page is grabbed during f2fs_add_link,
so that we can fall into deadlock condition like below.

INFO: task mknod:11006 blocked for more than 120 seconds.
      Tainted: G           OE  3.17.0-rc1+ #13
"echo 0 &gt; /proc/sys/kernel/hung_task_timeout_secs" disables this message.
mknod           D ffff88003fc94580     0 11006  11004 0x00000000
 ffff880007717b10 0000000000000002 ffff88003c323220 ffff880007717fd8
 0000000000014580 0000000000014580 ffff88003daecb30 ffff88003c323220
 ffff88003fc94e80 ffff88003ffbb4e8 ffff880007717ba0 0000000000000002
Call Trace:
 [&lt;ffffffff8173dc40&gt;] ? bit_wait+0x50/0x50
 [&lt;ffffffff8173d4cd&gt;] io_schedule+0x9d/0x130
 [&lt;ffffffff8173dc6c&gt;] bit_wait_io+0x2c/0x50
 [&lt;ffffffff8173da3b&gt;] __wait_on_bit_lock+0x4b/0xb0
 [&lt;ffffffff811640a7&gt;] __lock_page+0x67/0x70
 [&lt;ffffffff810acf50&gt;] ? autoremove_wake_function+0x40/0x40
 [&lt;ffffffff811652cc&gt;] pagecache_get_page+0x14c/0x1e0
 [&lt;ffffffffa029afa9&gt;] get_node_page+0x59/0x130 [f2fs]
 [&lt;ffffffffa02a63ad&gt;] read_all_xattrs+0x24d/0x430 [f2fs]
 [&lt;ffffffffa02a6ca2&gt;] f2fs_getxattr+0x52/0xe0 [f2fs]
 [&lt;ffffffffa02a7481&gt;] f2fs_get_acl+0x41/0x2d0 [f2fs]
 [&lt;ffffffff8122d847&gt;] get_acl+0x47/0x70
 [&lt;ffffffff8122db5a&gt;] posix_acl_create+0x5a/0x150
 [&lt;ffffffffa02a7759&gt;] f2fs_init_acl+0x29/0xcb [f2fs]
 [&lt;ffffffffa0286a8d&gt;] init_inode_metadata+0x5d/0x340 [f2fs]
 [&lt;ffffffffa029253a&gt;] f2fs_add_inline_entry+0x12a/0x2e0 [f2fs]
 [&lt;ffffffffa0286ea5&gt;] __f2fs_add_link+0x45/0x4a0 [f2fs]
 [&lt;ffffffffa028b5b6&gt;] ? f2fs_new_inode+0x146/0x220 [f2fs]
 [&lt;ffffffffa028b816&gt;] f2fs_mknod+0x86/0xf0 [f2fs]
 [&lt;ffffffff811e3ec1&gt;] vfs_mknod+0xe1/0x160
 [&lt;ffffffff811e4b26&gt;] SyS_mknod+0x1f6/0x200
 [&lt;ffffffff81741d7f&gt;] tracesys+0xe1/0xe6

Signed-off-by: Jaegeuk Kim &lt;jaegeuk@kernel.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Previously, init_inode_metadata does not hold any parent directory's inode
page. So, f2fs_init_acl can grab its parent inode page without any problem.
But, when we use inline_dentry, that page is grabbed during f2fs_add_link,
so that we can fall into deadlock condition like below.

INFO: task mknod:11006 blocked for more than 120 seconds.
      Tainted: G           OE  3.17.0-rc1+ #13
"echo 0 &gt; /proc/sys/kernel/hung_task_timeout_secs" disables this message.
mknod           D ffff88003fc94580     0 11006  11004 0x00000000
 ffff880007717b10 0000000000000002 ffff88003c323220 ffff880007717fd8
 0000000000014580 0000000000014580 ffff88003daecb30 ffff88003c323220
 ffff88003fc94e80 ffff88003ffbb4e8 ffff880007717ba0 0000000000000002
Call Trace:
 [&lt;ffffffff8173dc40&gt;] ? bit_wait+0x50/0x50
 [&lt;ffffffff8173d4cd&gt;] io_schedule+0x9d/0x130
 [&lt;ffffffff8173dc6c&gt;] bit_wait_io+0x2c/0x50
 [&lt;ffffffff8173da3b&gt;] __wait_on_bit_lock+0x4b/0xb0
 [&lt;ffffffff811640a7&gt;] __lock_page+0x67/0x70
 [&lt;ffffffff810acf50&gt;] ? autoremove_wake_function+0x40/0x40
 [&lt;ffffffff811652cc&gt;] pagecache_get_page+0x14c/0x1e0
 [&lt;ffffffffa029afa9&gt;] get_node_page+0x59/0x130 [f2fs]
 [&lt;ffffffffa02a63ad&gt;] read_all_xattrs+0x24d/0x430 [f2fs]
 [&lt;ffffffffa02a6ca2&gt;] f2fs_getxattr+0x52/0xe0 [f2fs]
 [&lt;ffffffffa02a7481&gt;] f2fs_get_acl+0x41/0x2d0 [f2fs]
 [&lt;ffffffff8122d847&gt;] get_acl+0x47/0x70
 [&lt;ffffffff8122db5a&gt;] posix_acl_create+0x5a/0x150
 [&lt;ffffffffa02a7759&gt;] f2fs_init_acl+0x29/0xcb [f2fs]
 [&lt;ffffffffa0286a8d&gt;] init_inode_metadata+0x5d/0x340 [f2fs]
 [&lt;ffffffffa029253a&gt;] f2fs_add_inline_entry+0x12a/0x2e0 [f2fs]
 [&lt;ffffffffa0286ea5&gt;] __f2fs_add_link+0x45/0x4a0 [f2fs]
 [&lt;ffffffffa028b5b6&gt;] ? f2fs_new_inode+0x146/0x220 [f2fs]
 [&lt;ffffffffa028b816&gt;] f2fs_mknod+0x86/0xf0 [f2fs]
 [&lt;ffffffff811e3ec1&gt;] vfs_mknod+0xe1/0x160
 [&lt;ffffffff811e4b26&gt;] SyS_mknod+0x1f6/0x200
 [&lt;ffffffff81741d7f&gt;] tracesys+0xe1/0xe6

Signed-off-by: Jaegeuk Kim &lt;jaegeuk@kernel.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>f2fs: remove the redundant validation check of acl</title>
<updated>2014-07-09T21:04:25+00:00</updated>
<author>
<name>Gu Zheng</name>
<email>guz.fnst@cn.fujitsu.com</email>
</author>
<published>2014-06-24T10:18:14+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=34e6d456da4a61f655655a6d431657da5753913f'/>
<id>34e6d456da4a61f655655a6d431657da5753913f</id>
<content type='text'>
kernel side(xx_init_acl), the acl is get/cloned from the parent dir's,
which is credible. So remove the redundant validation check of acl
here.

Signed-off-by: Gu Zheng &lt;guz.fnst@cn.fujitsu.com&gt;
Signed-off-by: Jaegeuk Kim &lt;jaegeuk@kernel.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
kernel side(xx_init_acl), the acl is get/cloned from the parent dir's,
which is credible. So remove the redundant validation check of acl
here.

Signed-off-by: Gu Zheng &lt;guz.fnst@cn.fujitsu.com&gt;
Signed-off-by: Jaegeuk Kim &lt;jaegeuk@kernel.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>f2fs: pass flags field to setxattr functions</title>
<updated>2014-05-07T01:21:56+00:00</updated>
<author>
<name>Jaegeuk Kim</name>
<email>jaegeuk.kim@samsung.com</email>
</author>
<published>2014-04-23T03:23:14+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=c02745ef684f9a6f98f30388ed048ee460db5483'/>
<id>c02745ef684f9a6f98f30388ed048ee460db5483</id>
<content type='text'>
This patch passes the "flags" field to the low level setxattr functions
to use XATTR_REPLACE in the following patches.

Signed-off-by: Jaegeuk Kim &lt;jaegeuk.kim@samsung.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This patch passes the "flags" field to the low level setxattr functions
to use XATTR_REPLACE in the following patches.

Signed-off-by: Jaegeuk Kim &lt;jaegeuk.kim@samsung.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>f2fs: check the acl's validity before setting</title>
<updated>2014-04-07T03:18:30+00:00</updated>
<author>
<name>ZhangZhen</name>
<email>zhenzhang.zhang@huawei.com</email>
</author>
<published>2014-04-04T01:47:16+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=3a8861e2715e3b985bfaac43bcdfcfebe9b423cb'/>
<id>3a8861e2715e3b985bfaac43bcdfcfebe9b423cb</id>
<content type='text'>
Before setting the acl, call posix_acl_valid() to check if it is
valid or not.

Signed-off-by: zhangzhen &lt;zhenzhang.zhang@huawei.com&gt;
Signed-off-by: Jaegeuk Kim &lt;jaegeuk.kim@samsung.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Before setting the acl, call posix_acl_valid() to check if it is
valid or not.

Signed-off-by: zhangzhen &lt;zhenzhang.zhang@huawei.com&gt;
Signed-off-by: Jaegeuk Kim &lt;jaegeuk.kim@samsung.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>f2fs: avoid RECLAIM_FS-ON-W warning</title>
<updated>2014-03-20T13:21:08+00:00</updated>
<author>
<name>Jaegeuk Kim</name>
<email>jaegeuk.kim@samsung.com</email>
</author>
<published>2014-03-20T13:21:08+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=808a1d7490671a74ffa077cf92779c7b0c9f66da'/>
<id>808a1d7490671a74ffa077cf92779c7b0c9f66da</id>
<content type='text'>
This patch should resolve the following possible bug.

RECLAIM_FS-ON-W at:
 mark_held_locks+0xb9/0x140
 lockdep_trace_alloc+0x85/0xf0
 __kmalloc+0x53/0x1d0
 read_all_xattrs+0x3d1/0x3f0 [f2fs]
 f2fs_getxattr+0x4f/0x100 [f2fs]
 f2fs_get_acl+0x4c/0x290 [f2fs]
 get_acl+0x4f/0x80
 posix_acl_create+0x72/0x180
 f2fs_init_acl+0x29/0xcc [f2fs]
 __f2fs_add_link+0x259/0x710 [f2fs]
 f2fs_create+0xad/0x1c0 [f2fs]
 vfs_create+0xed/0x150
 do_last+0xd36/0xed0
 path_openat+0xc5/0x680
 do_filp_open+0x43/0xa0
 do_sys_open+0x13c/0x230
 SyS_creat+0x1e/0x20
 system_call_fastpath+0x16/0x1b

Signed-off-by: Jaegeuk Kim &lt;jaegeuk.kim@samsung.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This patch should resolve the following possible bug.

RECLAIM_FS-ON-W at:
 mark_held_locks+0xb9/0x140
 lockdep_trace_alloc+0x85/0xf0
 __kmalloc+0x53/0x1d0
 read_all_xattrs+0x3d1/0x3f0 [f2fs]
 f2fs_getxattr+0x4f/0x100 [f2fs]
 f2fs_get_acl+0x4c/0x290 [f2fs]
 get_acl+0x4f/0x80
 posix_acl_create+0x72/0x180
 f2fs_init_acl+0x29/0xcc [f2fs]
 __f2fs_add_link+0x259/0x710 [f2fs]
 f2fs_create+0xad/0x1c0 [f2fs]
 vfs_create+0xed/0x150
 do_last+0xd36/0xed0
 path_openat+0xc5/0x680
 do_filp_open+0x43/0xa0
 do_sys_open+0x13c/0x230
 SyS_creat+0x1e/0x20
 system_call_fastpath+0x16/0x1b

Signed-off-by: Jaegeuk Kim &lt;jaegeuk.kim@samsung.com&gt;
</pre>
</div>
</content>
</entry>
</feed>
