* [PULL][PATCH 0/3] GFP flags adjustments
@ 2015-12-03 16:51 David Sterba
2015-12-03 16:51 ` [PATCH 1/3] btrfs: use GFP_KERNEL for allocations in ioctl handlers David Sterba
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: David Sterba @ 2015-12-03 16:51 UTC (permalink / raw)
To: linux-btrfs; +Cc: David Sterba, clm
Part of the planned memory allocation / error handling updates, a lightweight
start. We don't need to use GFP_NOFS everywhere, this flag should protect
against looping back to the filesystem in certain allocation contexts. GFP_KERNEL
is safe in functions started eg. from userspace (like the ioctls) or for
mount-time allocations. For 4.5, please pull.
----------------------------------------------------------------
The following changes since commit 1ec218373b8ebda821aec00bb156a9c94fad9cd4:
Linux 4.4-rc2 (2015-11-22 16:45:59 -0800)
are available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux.git dev/gfp-flags
for you to fetch changes up to 39a27ec1004e886f1d949bdb8f2616896d02c5c2:
btrfs: use GFP_KERNEL for xattr and acl allocations (2015-12-03 15:03:44 +0100)
----------------------------------------------------------------
David Sterba (3):
btrfs: use GFP_KERNEL for allocations in ioctl handlers
btrfs: use GFP_KERNEL for allocations of workqueues
btrfs: use GFP_KERNEL for xattr and acl allocations
fs/btrfs/acl.c | 4 ++--
fs/btrfs/async-thread.c | 4 ++--
fs/btrfs/ioctl.c | 10 +++++-----
fs/btrfs/xattr.c | 2 +-
4 files changed, 10 insertions(+), 10 deletions(-)
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 1/3] btrfs: use GFP_KERNEL for allocations in ioctl handlers
2015-12-03 16:51 [PULL][PATCH 0/3] GFP flags adjustments David Sterba
@ 2015-12-03 16:51 ` David Sterba
2015-12-03 16:51 ` [PATCH 2/3] btrfs: use GFP_KERNEL for allocations of workqueues David Sterba
2015-12-03 16:51 ` [PATCH 3/3] btrfs: use GFP_KERNEL for xattr and acl allocations David Sterba
2 siblings, 0 replies; 4+ messages in thread
From: David Sterba @ 2015-12-03 16:51 UTC (permalink / raw)
To: linux-btrfs; +Cc: David Sterba
We don't have to use GFP_NOFS in the ioctl handlers because there's no
risk of looping through the allocators back to the filesystem. This
patch covers only allocations that are directly in the ioctl handlers.
Signed-off-by: David Sterba <dsterba@suse.com>
---
fs/btrfs/ioctl.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c
index da94138eb85e..2f4a5c26a14f 100644
--- a/fs/btrfs/ioctl.c
+++ b/fs/btrfs/ioctl.c
@@ -4147,7 +4147,7 @@ static long btrfs_ioctl_space_info(struct btrfs_root *root, void __user *arg)
return -ENOMEM;
space_args.total_spaces = 0;
- dest = kmalloc(alloc_size, GFP_NOFS);
+ dest = kmalloc(alloc_size, GFP_KERNEL);
if (!dest)
return -ENOMEM;
dest_orig = dest;
@@ -4673,7 +4673,7 @@ static long btrfs_ioctl_balance(struct file *file, void __user *arg)
goto out_bargs;
}
- bctl = kzalloc(sizeof(*bctl), GFP_NOFS);
+ bctl = kzalloc(sizeof(*bctl), GFP_KERNEL);
if (!bctl) {
ret = -ENOMEM;
goto out_bargs;
@@ -4759,7 +4759,7 @@ static long btrfs_ioctl_balance_progress(struct btrfs_root *root,
goto out;
}
- bargs = kzalloc(sizeof(*bargs), GFP_NOFS);
+ bargs = kzalloc(sizeof(*bargs), GFP_KERNEL);
if (!bargs) {
ret = -ENOMEM;
goto out;
@@ -5019,7 +5019,7 @@ static long btrfs_ioctl_quota_rescan_status(struct file *file, void __user *arg)
if (!capable(CAP_SYS_ADMIN))
return -EPERM;
- qsa = kzalloc(sizeof(*qsa), GFP_NOFS);
+ qsa = kzalloc(sizeof(*qsa), GFP_KERNEL);
if (!qsa)
return -ENOMEM;
@@ -5149,7 +5149,7 @@ static long btrfs_ioctl_set_received_subvol_32(struct file *file,
goto out;
}
- args64 = kmalloc(sizeof(*args64), GFP_NOFS);
+ args64 = kmalloc(sizeof(*args64), GFP_KERNEL);
if (!args64) {
ret = -ENOMEM;
goto out;
--
2.6.2
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 2/3] btrfs: use GFP_KERNEL for allocations of workqueues
2015-12-03 16:51 [PULL][PATCH 0/3] GFP flags adjustments David Sterba
2015-12-03 16:51 ` [PATCH 1/3] btrfs: use GFP_KERNEL for allocations in ioctl handlers David Sterba
@ 2015-12-03 16:51 ` David Sterba
2015-12-03 16:51 ` [PATCH 3/3] btrfs: use GFP_KERNEL for xattr and acl allocations David Sterba
2 siblings, 0 replies; 4+ messages in thread
From: David Sterba @ 2015-12-03 16:51 UTC (permalink / raw)
To: linux-btrfs; +Cc: David Sterba
We don't have to use GFP_NOFS to allocate workqueue structures, this is
done from mount context or potentially scrub start context, safe to fail
in both cases.
Signed-off-by: David Sterba <dsterba@suse.com>
---
fs/btrfs/async-thread.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/fs/btrfs/async-thread.c b/fs/btrfs/async-thread.c
index 3e36e4adc4a3..88d9af3d4581 100644
--- a/fs/btrfs/async-thread.c
+++ b/fs/btrfs/async-thread.c
@@ -97,7 +97,7 @@ static struct __btrfs_workqueue *
__btrfs_alloc_workqueue(const char *name, unsigned int flags, int limit_active,
int thresh)
{
- struct __btrfs_workqueue *ret = kzalloc(sizeof(*ret), GFP_NOFS);
+ struct __btrfs_workqueue *ret = kzalloc(sizeof(*ret), GFP_KERNEL);
if (!ret)
return NULL;
@@ -148,7 +148,7 @@ struct btrfs_workqueue *btrfs_alloc_workqueue(const char *name,
int limit_active,
int thresh)
{
- struct btrfs_workqueue *ret = kzalloc(sizeof(*ret), GFP_NOFS);
+ struct btrfs_workqueue *ret = kzalloc(sizeof(*ret), GFP_KERNEL);
if (!ret)
return NULL;
--
2.6.2
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 3/3] btrfs: use GFP_KERNEL for xattr and acl allocations
2015-12-03 16:51 [PULL][PATCH 0/3] GFP flags adjustments David Sterba
2015-12-03 16:51 ` [PATCH 1/3] btrfs: use GFP_KERNEL for allocations in ioctl handlers David Sterba
2015-12-03 16:51 ` [PATCH 2/3] btrfs: use GFP_KERNEL for allocations of workqueues David Sterba
@ 2015-12-03 16:51 ` David Sterba
2 siblings, 0 replies; 4+ messages in thread
From: David Sterba @ 2015-12-03 16:51 UTC (permalink / raw)
To: linux-btrfs; +Cc: David Sterba
We don't have to use GFP_NOFS in context of ACL or XATTR actions, not
possible to loop through the allocator and it's safe to fail with
ENOMEM.
Signed-off-by: David Sterba <dsterba@suse.com>
---
fs/btrfs/acl.c | 4 ++--
fs/btrfs/xattr.c | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/fs/btrfs/acl.c b/fs/btrfs/acl.c
index 9a0124a95851..dbbb8ed53a51 100644
--- a/fs/btrfs/acl.c
+++ b/fs/btrfs/acl.c
@@ -48,7 +48,7 @@ struct posix_acl *btrfs_get_acl(struct inode *inode, int type)
size = __btrfs_getxattr(inode, name, "", 0);
if (size > 0) {
- value = kzalloc(size, GFP_NOFS);
+ value = kzalloc(size, GFP_KERNEL);
if (!value)
return ERR_PTR(-ENOMEM);
size = __btrfs_getxattr(inode, name, value, size);
@@ -102,7 +102,7 @@ static int __btrfs_set_acl(struct btrfs_trans_handle *trans,
if (acl) {
size = posix_acl_xattr_size(acl->a_count);
- value = kmalloc(size, GFP_NOFS);
+ value = kmalloc(size, GFP_KERNEL);
if (!value) {
ret = -ENOMEM;
goto out;
diff --git a/fs/btrfs/xattr.c b/fs/btrfs/xattr.c
index 1fcd7b6e7564..24e8ff722730 100644
--- a/fs/btrfs/xattr.c
+++ b/fs/btrfs/xattr.c
@@ -494,7 +494,7 @@ static int btrfs_initxattrs(struct inode *inode,
for (xattr = xattr_array; xattr->name != NULL; xattr++) {
name = kmalloc(XATTR_SECURITY_PREFIX_LEN +
- strlen(xattr->name) + 1, GFP_NOFS);
+ strlen(xattr->name) + 1, GFP_KERNEL);
if (!name) {
err = -ENOMEM;
break;
--
2.6.2
^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2015-12-03 16:53 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-12-03 16:51 [PULL][PATCH 0/3] GFP flags adjustments David Sterba
2015-12-03 16:51 ` [PATCH 1/3] btrfs: use GFP_KERNEL for allocations in ioctl handlers David Sterba
2015-12-03 16:51 ` [PATCH 2/3] btrfs: use GFP_KERNEL for allocations of workqueues David Sterba
2015-12-03 16:51 ` [PATCH 3/3] btrfs: use GFP_KERNEL for xattr and acl allocations David Sterba
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.