Skip to contentSkip to conversation

smb: client: change allocation requirements in DUP_CTX_STR macro

PATCH In review Fredric Cover 2 participants 3 messages May 13 – May 20

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 smb: client: change allocation requirements in DUP_CTX_STR macro

From: Fredric Cover <[email protected]>

Currently, the macro DUP_CTX_STR allocates new_ctx->field using GFP_ATOMIC. DUP_CTX_STR is only used in smb3_fs_context_dup(), which is never called in an atomic context. Using GFP_ATOMIC puts unnecessary pressure on emergency memory pools.

Change GFP_ATOMIC to GFP_KERNEL.

---
 fs/smb/client/fs_context.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/smb/client/fs_context.c +1 -1
index b9544eb03..a3ccc06c0 100644
@@ -420,7 +420,7 @@ static int parse_symlink_flavor(struct fs_context *fc, char *value,
 #define DUP_CTX_STR(field)						\
 do {									\
 	if (ctx->field) {						\
-		new_ctx->field = kstrdup(ctx->field, GFP_ATOMIC);	\
+		new_ctx->field = kstrdup(ctx->field, GFP_KERNEL);	\
 		if (new_ctx->field == NULL) {				\
 			smb3_cleanup_fs_context_contents(new_ctx);	\
 			return -ENOMEM;					\
Signature · 1 line
2.53.0
#1 lore raw

Hi Steve,

Following up on this patch. This logic should remain sound and still merge properly.
Let me know if you need any modifications.

Thanks,
Fredric Cover

Quoted 31 lines · Fredric Cover

From: Fredric Cover <[email protected]>

Currently, the macro DUP_CTX_STR allocates new_ctx->field using GFP_ATOMIC. DUP_CTX_STR is only used in smb3_fs_context_dup(), which is never called in an atomic context. Using GFP_ATOMIC puts unnecessary pressure on emergency memory pools.

Change GFP_ATOMIC to GFP_KERNEL.

---
 fs/smb/client/fs_context.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/smb/client/fs_context.c +1 -2
index b9544eb03..a3ccc06c0 100644
@@ -420,7 +420,7 @@ static int parse_symlink_flavor(struct fs_context *fc, char *value,
 #define DUP_CTX_STR(field)                                             \
 do {                                                                   \
        if (ctx->field) {                                               \
-               new_ctx->field = kstrdup(ctx->field, GFP_ATOMIC);       \
+               new_ctx->field = kstrdup(ctx->field, GFP_KERNEL);       \
                if (new_ctx->field == NULL) {                           \
                        smb3_cleanup_fs_context_contents(new_ctx);      \
                        return -ENOMEM;                                 \
--

2.53.0

#2 lore raw

merged into cifs-2.6.git for-next pending additional testing and review

Quoted 44 lines · Fredric Cover

Hi Steve,

Following up on this patch. This logic should remain sound and still merge properly.
Let me know if you need any modifications.

Thanks,
Fredric Cover

Quoted 31 lines · Fredric Cover

From: Fredric Cover <[email protected]>

Currently, the macro DUP_CTX_STR allocates new_ctx->field using GFP_ATOMIC. DUP_CTX_STR is only used in smb3_fs_context_dup(), which is never called in an atomic context. Using GFP_ATOMIC puts unnecessary pressure on emergency memory pools.

Change GFP_ATOMIC to GFP_KERNEL.

---
 fs/smb/client/fs_context.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/smb/client/fs_context.c +1 -2
index b9544eb03..a3ccc06c0 100644
@@ -420,7 +420,7 @@ static int parse_symlink_flavor(struct fs_context *fc, char *value,
 #define DUP_CTX_STR(field)                                             \
 do {                                                                   \
        if (ctx->field) {                                               \
-               new_ctx->field = kstrdup(ctx->field, GFP_ATOMIC);       \
+               new_ctx->field = kstrdup(ctx->field, GFP_KERNEL);       \
                if (new_ctx->field == NULL) {                           \
                        smb3_cleanup_fs_context_contents(new_ctx);      \
                        return -ENOMEM;                                 \
--

2.53.0

Signature · 3 lines
Thanks,

Steve