diff options
author | Jaegeuk Kim <jaegeuk@kernel.org> | 2014-12-18 22:32:36 -0500 |
---|---|---|
committer | Jaegeuk Kim <jaegeuk@kernel.org> | 2015-01-09 20:02:25 -0500 |
commit | dd802406e396c22dfb5aa0d16196f04d515be49e (patch) | |
tree | dd7c8361203983936bc6ef5f6c61234a69eadfd0 /fs/f2fs/acl.c | |
parent | db9f7c1a9561e998d6227bcc1c19bc4c1fbbca1b (diff) |
f2fs: avoid double lock for cp_rwsem
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
-> here down_read should wait forever.
Reviewed-by: Chao Yu <chao2.yu@samsung.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Diffstat (limited to 'fs/f2fs/acl.c')
-rw-r--r-- | fs/f2fs/acl.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/fs/f2fs/acl.c b/fs/f2fs/acl.c index 1ccb26bc2a0b..7f12d28ad94c 100644 --- a/fs/f2fs/acl.c +++ b/fs/f2fs/acl.c | |||
@@ -62,7 +62,7 @@ static struct posix_acl *f2fs_acl_from_disk(const char *value, size_t size) | |||
62 | if (count == 0) | 62 | if (count == 0) |
63 | return NULL; | 63 | return NULL; |
64 | 64 | ||
65 | acl = posix_acl_alloc(count, GFP_KERNEL); | 65 | acl = posix_acl_alloc(count, GFP_NOFS); |
66 | if (!acl) | 66 | if (!acl) |
67 | return ERR_PTR(-ENOMEM); | 67 | return ERR_PTR(-ENOMEM); |
68 | 68 | ||
@@ -116,7 +116,7 @@ static void *f2fs_acl_to_disk(const struct posix_acl *acl, size_t *size) | |||
116 | int i; | 116 | int i; |
117 | 117 | ||
118 | f2fs_acl = kmalloc(sizeof(struct f2fs_acl_header) + acl->a_count * | 118 | f2fs_acl = kmalloc(sizeof(struct f2fs_acl_header) + acl->a_count * |
119 | sizeof(struct f2fs_acl_entry), GFP_KERNEL); | 119 | sizeof(struct f2fs_acl_entry), GFP_NOFS); |
120 | if (!f2fs_acl) | 120 | if (!f2fs_acl) |
121 | return ERR_PTR(-ENOMEM); | 121 | return ERR_PTR(-ENOMEM); |
122 | 122 | ||