Skip to contentSkip to conversation

linux-next: build failure after merge of the ext3 tree

DISCUSSION Stephen Rothwell 3 participants 3 messages Mar 7, 2024

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

Hi all,

After merging the ext3 tree, today's linux-next build (x86_64 allmodconfig) failed like this:

In file included from include/linux/sysctl.h:27,
from include/linux/fanotify.h:5,
from fs/notify/fanotify/fanotify.c:2:
fs/notify/fanotify/fanotify.c: In function 'fanotify_get_response':
fs/notify/fanotify/fanotify.c:233:48: error: suggest parentheses around arithmetic in operand of '|' [-Werror=parentheses]

  233 |                                   TASK_KILLABLE|TASK_FREEZABLE);
      |                                                ^
include/linux/wait.h:283:11: note: in definition of macro '___wait_is_interruptible'
  283 |          (state & (TASK_INTERRUPTIBLE | TASK_WAKEKILL)))
      |           ^~~~~
include/linux/wait.h:935:9: note: in expansion of macro '___wait_event'
  935 |         ___wait_event(wq, condition, state, 0, 0, schedule())
      |         ^~~~~~~~~~~~~
include/linux/wait.h:958:25: note: in expansion of macro '__wait_event_state'
  958 |                 __ret = __wait_event_state(wq_head, condition, state);          \
      |                         ^~~~~~~~~~~~~~~~~~
fs/notify/fanotify/fanotify.c:231:15: note: in expansion of macro 'wait_event_state'
  231 |         ret = wait_event_state(group->fanotify_data.access_waitq,
      |               ^~~~~~~~~~~~~~~~

cc1: all warnings being treated as errors

Caused by commit

3440e7e55ced ("fanotify: allow freeze when waiting response for permission events")

Though, I guess, you could argue that the ___wait_is_interruptible macro should parenthesise the use of its "state" argument.

I have used the ext3 tree from next-20240306 for today.

Signature · 2 lines
Cheers,
Stephen Rothwell
#1 lore raw
Quoted 29 lines · On Thu, 7 Mar 2024 11:07:17 +1100 Stephen Rothwell <[email protected]> wrote:

Hi all,

After merging the ext3 tree, today's linux-next build (x86_64 allmodconfig) failed like this:

In file included from include/linux/sysctl.h:27,
from include/linux/fanotify.h:5,
from fs/notify/fanotify/fanotify.c:2:
fs/notify/fanotify/fanotify.c: In function 'fanotify_get_response':
fs/notify/fanotify/fanotify.c:233:48: error: suggest parentheses around arithmetic in operand of '|' [-Werror=parentheses] 233 |

                            TASK_KILLABLE|TASK_FREEZABLE); |
                                      ^ include/linux/wait.h:283:11:

note: in definition of macro '___wait_is_interruptible' 283 |
(state & (TASK_INTERRUPTIBLE | TASK_WAKEKILL))) | ^~~~~
include/linux/wait.h:935:9: note: in expansion of macro
'___wait_event' 935 | ___wait_event(wq, condition, state, 0,
0, schedule()) | ^~~~~~~~~~~~~
include/linux/wait.h:958:25: note: in expansion of macro
'__wait_event_state' 958 | __ret =
__wait_event_state(wq_head, condition, state); \ |

              ^~~~~~~~~~~~~~~~~~

fs/notify/fanotify/fanotify.c:231:15: note: in expansion of macro
'wait_event_state' 231 | ret =
wait_event_state(group->fanotify_data.access_waitq, | ^~~~~~~~~~~~~~~~ cc1: all warnings being treated as errors

Caused by commit

Quoted 8 lines

3440e7e55ced ("fanotify: allow freeze when waiting response for
permission events")

Though, I guess, you could argue that the ___wait_is_interruptible macro should parenthesise the use of its "state" argument.

I have used the ext3 tree from next-20240306 for today.

Sorry I missed this warning. And agreed! I can add parentheses on the call side, but it may be more reasonable to add them in the macro.

Hey Peter,

Could you please take a look at the patch attached at your convenience? Thanks!

Signature · 2 lines
Thanks,
Winston

From 17bdb67492823e90e77f4e3159d631efc4cdd865 Mon Sep 17 00:00:00 2001
From: Winston Wen <[email protected]>
Date: Thu, 7 Mar 2024 10:59:59 +0800
Subject: [PATCH 1/2] wait: add parentheses to "state" argument in macro

Now if we use macro wait_event_state() like this:

        wait_event_state(waitq, condition,
                        TASK_KILLABLE|TASK_FREEZABLE);

we'll get a build warning in __wait_is_interruptible because of:

((state) & (TASK_INTERRUPTIBLE | TASK_WAKEKILL)))

Parenthesise the use of "state" argument to avoid this warning as it's very common to use "TASK_*|TASK_*" as function parameter in kernel.

---
 include/linux/wait.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/wait.h +1 -1
index 8aa3372f21a0..a4e57865aded 100644
@@ -280,7 +280,7 @@ static inline void wake_up_pollfree(struct wait_queue_head *wq_head)
 
 #define ___wait_is_interruptible(state)						\
 	(!__builtin_constant_p(state) ||					\
-	 (state & (TASK_INTERRUPTIBLE | TASK_WAKEKILL)))
+	 ((state) & (TASK_INTERRUPTIBLE | TASK_WAKEKILL)))
 
 extern void init_wait_entry(struct wait_queue_entry *wq_entry, int flags);
 
Signature · 1 line
2.43.0
#2 lore raw
Quoted 35 lines · Winston Wen
Quoted 32 lines · On Thu, 7 Mar 2024 11:07:17 +1100 Stephen Rothwell <[email protected]> wrote:

Hi all,

After merging the ext3 tree, today's linux-next build (x86_64 allmodconfig) failed like this:

In file included from include/linux/sysctl.h:27,
from include/linux/fanotify.h:5,
from fs/notify/fanotify/fanotify.c:2:
fs/notify/fanotify/fanotify.c: In function 'fanotify_get_response':
fs/notify/fanotify/fanotify.c:233:48: error: suggest parentheses around arithmetic in operand of '|' [-Werror=parentheses] 233 |

                            TASK_KILLABLE|TASK_FREEZABLE); |
                                      ^ include/linux/wait.h:283:11:

note: in definition of macro '___wait_is_interruptible' 283 |
(state & (TASK_INTERRUPTIBLE | TASK_WAKEKILL))) | ^~~~~
include/linux/wait.h:935:9: note: in expansion of macro
'___wait_event' 935 | ___wait_event(wq, condition, state, 0,
0, schedule()) | ^~~~~~~~~~~~~
include/linux/wait.h:958:25: note: in expansion of macro
'__wait_event_state' 958 | __ret =
__wait_event_state(wq_head, condition, state); \ |

              ^~~~~~~~~~~~~~~~~~

fs/notify/fanotify/fanotify.c:231:15: note: in expansion of macro
'wait_event_state' 231 | ret =
wait_event_state(group->fanotify_data.access_waitq, | ^~~~~~~~~~~~~~~~ cc1: all warnings being treated as errors

Caused by commit

3440e7e55ced ("fanotify: allow freeze when waiting response for
permission events")

Quoted 8 lines
Quoted 5 lines

Though, I guess, you could argue that the ___wait_is_interruptible macro should parenthesise the use of its "state" argument.

I have used the ext3 tree from next-20240306 for today.

Sorry I missed this warning. And agreed! I can add parentheses on the call side, but it may be more reasonable to add them in the macro.

Thanks for fixing this and I agree. For now, I've also pushed out a new version of your patch with additional parentheses into my tree to unblock it for linux-next.

Honza

Signature · 2 lines
Jan Kara <[email protected]>
SUSE Labs, CR