linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/4] More GFP_NOFS removals
@ 2017-02-13 13:50 David Sterba
  2017-02-13 13:50 ` [PATCH 1/4] btrfs: use GFP_KERNEL in create_snapshot David Sterba
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: David Sterba @ 2017-02-13 13:50 UTC (permalink / raw)
  To: linux-btrfs, clm; +Cc: David Sterba

A few more conversions to less strict allocation flags, calls originating from
an ioctl and with no chance of getting back with a lock already held. For 4.11.


The following changes since commit 2e94257a41fece589dc4bd737c70dc770e9040ef:

  btrfs: Better csum error message for data csum mismatch (2017-02-10 18:04:51 +0100)

are available in the git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux.git dev/less-nofs

for you to fetch changes up to 8d310939a7d232fc71524fdf83f5a8fdbd5eb31c:

  btrfs: use GFP_KERNEL in btrfs_add/del_qgroup_relation (2017-02-13 13:11:29 +0100)

----------------------------------------------------------------
David Sterba (4):
      btrfs: use GFP_KERNEL in create_snapshot
      btrfs: use GFP_KERNEL in btrfs_read_qgroup_config
      btrfs: use GFP_KERNEL in btrfs_quota_enable
      btrfs: use GFP_KERNEL in btrfs_add/del_qgroup_relation

 fs/btrfs/ioctl.c  | 4 ++--
 fs/btrfs/qgroup.c | 8 ++++----
 2 files changed, 6 insertions(+), 6 deletions(-)

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 1/4] btrfs: use GFP_KERNEL in create_snapshot
  2017-02-13 13:50 [PATCH 0/4] More GFP_NOFS removals David Sterba
@ 2017-02-13 13:50 ` David Sterba
  2017-02-13 13:50 ` [PATCH 2/4] btrfs: use GFP_KERNEL in btrfs_read_qgroup_config David Sterba
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: David Sterba @ 2017-02-13 13:50 UTC (permalink / raw)
  To: linux-btrfs; +Cc: David Sterba

We don't need to use GFP_NOFS here as this is called from ioctls an the
only lock held is the subvol_sem, which is of a high level and protects
creation/renames/deletion and is never held in the writeout paths.

Signed-off-by: David Sterba <dsterba@suse.com>
---
 fs/btrfs/ioctl.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c
index 77f93a1e65c7..f65ace58dd2c 100644
--- a/fs/btrfs/ioctl.c
+++ b/fs/btrfs/ioctl.c
@@ -670,12 +670,12 @@ static int create_snapshot(struct btrfs_root *root, struct inode *dir,
 	if (!test_bit(BTRFS_ROOT_REF_COWS, &root->state))
 		return -EINVAL;
 
-	pending_snapshot = kzalloc(sizeof(*pending_snapshot), GFP_NOFS);
+	pending_snapshot = kzalloc(sizeof(*pending_snapshot), GFP_KERNEL);
 	if (!pending_snapshot)
 		return -ENOMEM;
 
 	pending_snapshot->root_item = kzalloc(sizeof(struct btrfs_root_item),
-			GFP_NOFS);
+			GFP_KERNEL);
 	pending_snapshot->path = btrfs_alloc_path();
 	if (!pending_snapshot->root_item || !pending_snapshot->path) {
 		ret = -ENOMEM;
-- 
2.10.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 2/4] btrfs: use GFP_KERNEL in btrfs_read_qgroup_config
  2017-02-13 13:50 [PATCH 0/4] More GFP_NOFS removals David Sterba
  2017-02-13 13:50 ` [PATCH 1/4] btrfs: use GFP_KERNEL in create_snapshot David Sterba
@ 2017-02-13 13:50 ` David Sterba
  2017-02-13 13:50 ` [PATCH 3/4] btrfs: use GFP_KERNEL in btrfs_quota_enable David Sterba
  2017-02-13 13:50 ` [PATCH 4/4] btrfs: use GFP_KERNEL in btrfs_add/del_qgroup_relation David Sterba
  3 siblings, 0 replies; 5+ messages in thread
From: David Sterba @ 2017-02-13 13:50 UTC (permalink / raw)
  To: linux-btrfs; +Cc: David Sterba

The qgroup config is read during mount, we do not have to use NOFS.

Signed-off-by: David Sterba <dsterba@suse.com>
---
 fs/btrfs/qgroup.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/btrfs/qgroup.c b/fs/btrfs/qgroup.c
index 8496dbf3f38b..cdd0a16bf469 100644
--- a/fs/btrfs/qgroup.c
+++ b/fs/btrfs/qgroup.c
@@ -319,7 +319,7 @@ int btrfs_read_qgroup_config(struct btrfs_fs_info *fs_info)
 	if (!test_bit(BTRFS_FS_QUOTA_ENABLED, &fs_info->flags))
 		return 0;
 
-	fs_info->qgroup_ulist = ulist_alloc(GFP_NOFS);
+	fs_info->qgroup_ulist = ulist_alloc(GFP_KERNEL);
 	if (!fs_info->qgroup_ulist) {
 		ret = -ENOMEM;
 		goto out;
-- 
2.10.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 3/4] btrfs: use GFP_KERNEL in btrfs_quota_enable
  2017-02-13 13:50 [PATCH 0/4] More GFP_NOFS removals David Sterba
  2017-02-13 13:50 ` [PATCH 1/4] btrfs: use GFP_KERNEL in create_snapshot David Sterba
  2017-02-13 13:50 ` [PATCH 2/4] btrfs: use GFP_KERNEL in btrfs_read_qgroup_config David Sterba
@ 2017-02-13 13:50 ` David Sterba
  2017-02-13 13:50 ` [PATCH 4/4] btrfs: use GFP_KERNEL in btrfs_add/del_qgroup_relation David Sterba
  3 siblings, 0 replies; 5+ messages in thread
From: David Sterba @ 2017-02-13 13:50 UTC (permalink / raw)
  To: linux-btrfs; +Cc: David Sterba

We don't need to use GFP_NOFS here as this is called from ioctls an the
only lock held is the subvol_sem, which is of a high level and protects
creation/renames/deletion and is never held in the writeout paths.

Signed-off-by: David Sterba <dsterba@suse.com>
---
 fs/btrfs/qgroup.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/btrfs/qgroup.c b/fs/btrfs/qgroup.c
index cdd0a16bf469..4759fd46cfb5 100644
--- a/fs/btrfs/qgroup.c
+++ b/fs/btrfs/qgroup.c
@@ -876,7 +876,7 @@ int btrfs_quota_enable(struct btrfs_trans_handle *trans,
 		goto out;
 	}
 
-	fs_info->qgroup_ulist = ulist_alloc(GFP_NOFS);
+	fs_info->qgroup_ulist = ulist_alloc(GFP_KERNEL);
 	if (!fs_info->qgroup_ulist) {
 		ret = -ENOMEM;
 		goto out;
-- 
2.10.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 4/4] btrfs: use GFP_KERNEL in btrfs_add/del_qgroup_relation
  2017-02-13 13:50 [PATCH 0/4] More GFP_NOFS removals David Sterba
                   ` (2 preceding siblings ...)
  2017-02-13 13:50 ` [PATCH 3/4] btrfs: use GFP_KERNEL in btrfs_quota_enable David Sterba
@ 2017-02-13 13:50 ` David Sterba
  3 siblings, 0 replies; 5+ messages in thread
From: David Sterba @ 2017-02-13 13:50 UTC (permalink / raw)
  To: linux-btrfs; +Cc: David Sterba

Qgroup relations are added/deleted from ioctl, we hold the high level
qgroup lock, no deadlocks or recursion from the allocation possible
here.

Signed-off-by: David Sterba <dsterba@suse.com>
---
 fs/btrfs/qgroup.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/btrfs/qgroup.c b/fs/btrfs/qgroup.c
index 4759fd46cfb5..d97353440a70 100644
--- a/fs/btrfs/qgroup.c
+++ b/fs/btrfs/qgroup.c
@@ -1174,7 +1174,7 @@ int btrfs_add_qgroup_relation(struct btrfs_trans_handle *trans,
 	if (btrfs_qgroup_level(src) >= btrfs_qgroup_level(dst))
 		return -EINVAL;
 
-	tmp = ulist_alloc(GFP_NOFS);
+	tmp = ulist_alloc(GFP_KERNEL);
 	if (!tmp)
 		return -ENOMEM;
 
@@ -1234,7 +1234,7 @@ int __del_qgroup_relation(struct btrfs_trans_handle *trans,
 	int ret = 0;
 	int err;
 
-	tmp = ulist_alloc(GFP_NOFS);
+	tmp = ulist_alloc(GFP_KERNEL);
 	if (!tmp)
 		return -ENOMEM;
 
-- 
2.10.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2017-02-13 13:50 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-02-13 13:50 [PATCH 0/4] More GFP_NOFS removals David Sterba
2017-02-13 13:50 ` [PATCH 1/4] btrfs: use GFP_KERNEL in create_snapshot David Sterba
2017-02-13 13:50 ` [PATCH 2/4] btrfs: use GFP_KERNEL in btrfs_read_qgroup_config David Sterba
2017-02-13 13:50 ` [PATCH 3/4] btrfs: use GFP_KERNEL in btrfs_quota_enable David Sterba
2017-02-13 13:50 ` [PATCH 4/4] btrfs: use GFP_KERNEL in btrfs_add/del_qgroup_relation David Sterba

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).