Message ID | d27daedb9fd68b23e25bc63f2852f25a803cdefb.1491477181.git.bcodding@redhat.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On Thu, 2017-04-06 at 07:23 -0400, Benjamin Coddington wrote: > Set FL_CLOSE in fl_flags as in locks_remove_posix() when clearing locks. > NFS will check for this flag to ensure an unlock is sent in a following > patch. > > Fuse handles flock and posix locks differently for FL_CLOSE, and so > requires a fixup to retain the existing behavior for flock. > > Signed-off-by: Benjamin Coddington <bcodding@redhat.com> > --- > fs/fuse/file.c | 2 +- > fs/locks.c | 2 +- > include/linux/fs.h | 2 ++ > 3 files changed, 4 insertions(+), 2 deletions(-) > > diff --git a/fs/fuse/file.c b/fs/fuse/file.c > index 2401c5dabb2a..79e1a3a048a8 100644 > --- a/fs/fuse/file.c > +++ b/fs/fuse/file.c > @@ -2172,7 +2172,7 @@ static int fuse_setlk(struct file *file, struct file_lock *fl, int flock) > } > > /* Unlock on close is handled by the flush method */ > - if (fl->fl_flags & FL_CLOSE) > + if (fl->fl_flags & FL_CLOSE_POSIX == FL_CLOSE_POSIX) > return 0; > > fuse_lk_fill(&args, file, fl, opcode, pid, flock, &inarg); > diff --git a/fs/locks.c b/fs/locks.c > index 26811321d39b..af2031a1fcff 100644 > --- a/fs/locks.c > +++ b/fs/locks.c > @@ -2504,7 +2504,7 @@ locks_remove_flock(struct file *filp, struct file_lock_context *flctx) > .fl_owner = filp, > .fl_pid = current->tgid, > .fl_file = filp, > - .fl_flags = FL_FLOCK, > + .fl_flags = FL_FLOCK | FL_CLOSE, > .fl_type = F_UNLCK, > .fl_end = OFFSET_MAX, > }; > diff --git a/include/linux/fs.h b/include/linux/fs.h > index 2ba074328894..e964ae0a9c29 100644 > --- a/include/linux/fs.h > +++ b/include/linux/fs.h > @@ -903,6 +903,8 @@ static inline struct file *get_file(struct file *f) > #define FL_OFDLCK 1024 /* lock is "owned" by struct file */ > #define FL_LAYOUT 2048 /* outstanding pNFS layout */ > > +#define FL_CLOSE_POSIX (FL_POSIX | FL_CLOSE) > + > /* > * Special return value from posix_lock_file() and vfs_lock_file() for > * asynchronous locking. Reviewed-by: Jeff Layton <jlayton@redhat.com>
Hi Benjamin, [auto build test WARNING on nfs/linux-next] [also build test WARNING on v4.11-rc5 next-20170407] [if your patch is applied to the wrong git tree, please drop us a note to help improve the system] url: https://github.com/0day-ci/linux/commits/Benjamin-Coddington/Skipped-unlocks/20170407-045120 base: git://git.linux-nfs.org/projects/trondmy/linux-nfs.git linux-next config: x86_64-randconfig-n0-04081158 (attached as .config) compiler: gcc-4.8 (Debian 4.8.4-1) 4.8.4 reproduce: # save the attached .config to linux build tree make ARCH=x86_64 All warnings (new ones prefixed by >>): fs/fuse/file.c: In function 'fuse_setlk': fs/fuse/file.c:2171:2: warning: suggest parentheses around comparison in operand of '&' [-Wparentheses] if (fl->fl_flags & FL_CLOSE_POSIX == FL_CLOSE_POSIX) ^ fs/fuse/file.c:2171:2: warning: suggest parentheses around comparison in operand of '&' [-Wparentheses] In file included from include/uapi/linux/stddef.h:1:0, from include/linux/stddef.h:4, from include/uapi/linux/posix_types.h:4, from include/uapi/linux/types.h:13, from include/linux/types.h:5, from include/uapi/linux/fuse.h:121, from fs/fuse/fuse_i.h:12, from fs/fuse/file.c:9: >> include/linux/compiler.h:163:17: warning: suggest parentheses around comparison in operand of '&' [-Wparentheses] static struct ftrace_branch_data \ ^ include/linux/compiler.h:158:23: note: in expansion of macro '__trace_if' #define if(cond, ...) __trace_if( (cond , ## __VA_ARGS__) ) ^ fs/fuse/file.c:2171:2: note: in expansion of macro 'if' if (fl->fl_flags & FL_CLOSE_POSIX == FL_CLOSE_POSIX) ^ -- fs//fuse/file.c: In function 'fuse_setlk': fs//fuse/file.c:2171:2: warning: suggest parentheses around comparison in operand of '&' [-Wparentheses] if (fl->fl_flags & FL_CLOSE_POSIX == FL_CLOSE_POSIX) ^ fs//fuse/file.c:2171:2: warning: suggest parentheses around comparison in operand of '&' [-Wparentheses] In file included from include/uapi/linux/stddef.h:1:0, from include/linux/stddef.h:4, from include/uapi/linux/posix_types.h:4, from include/uapi/linux/types.h:13, from include/linux/types.h:5, from include/uapi/linux/fuse.h:121, from fs//fuse/fuse_i.h:12, from fs//fuse/file.c:9: >> include/linux/compiler.h:163:17: warning: suggest parentheses around comparison in operand of '&' [-Wparentheses] static struct ftrace_branch_data \ ^ include/linux/compiler.h:158:23: note: in expansion of macro '__trace_if' #define if(cond, ...) __trace_if( (cond , ## __VA_ARGS__) ) ^ fs//fuse/file.c:2171:2: note: in expansion of macro 'if' if (fl->fl_flags & FL_CLOSE_POSIX == FL_CLOSE_POSIX) ^ vim +163 include/linux/compiler.h d45ae1f7 Steven Rostedt (VMware 2017-01-17 147) # define likely(x) (__branch_check__(x, 1, __builtin_constant_p(x))) 1f0d69a9 Steven Rostedt 2008-11-12 148 # endif 1f0d69a9 Steven Rostedt 2008-11-12 149 # ifndef unlikely d45ae1f7 Steven Rostedt (VMware 2017-01-17 150) # define unlikely(x) (__branch_check__(x, 0, __builtin_constant_p(x))) 1f0d69a9 Steven Rostedt 2008-11-12 151 # endif 2bcd521a Steven Rostedt 2008-11-21 152 2bcd521a Steven Rostedt 2008-11-21 153 #ifdef CONFIG_PROFILE_ALL_BRANCHES 2bcd521a Steven Rostedt 2008-11-21 154 /* 2bcd521a Steven Rostedt 2008-11-21 155 * "Define 'is'", Bill Clinton 2bcd521a Steven Rostedt 2008-11-21 156 * "Define 'if'", Steven Rostedt 2bcd521a Steven Rostedt 2008-11-21 157 */ ab3c9c68 Linus Torvalds 2009-04-07 158 #define if(cond, ...) __trace_if( (cond , ## __VA_ARGS__) ) ab3c9c68 Linus Torvalds 2009-04-07 159 #define __trace_if(cond) \ b33c8ff4 Arnd Bergmann 2016-02-12 160 if (__builtin_constant_p(!!(cond)) ? !!(cond) : \ 2bcd521a Steven Rostedt 2008-11-21 161 ({ \ 2bcd521a Steven Rostedt 2008-11-21 162 int ______r; \ 2bcd521a Steven Rostedt 2008-11-21 @163 static struct ftrace_branch_data \ 2bcd521a Steven Rostedt 2008-11-21 164 __attribute__((__aligned__(4))) \ 2bcd521a Steven Rostedt 2008-11-21 165 __attribute__((section("_ftrace_branch"))) \ 2bcd521a Steven Rostedt 2008-11-21 166 ______f = { \ 2bcd521a Steven Rostedt 2008-11-21 167 .func = __func__, \ 2bcd521a Steven Rostedt 2008-11-21 168 .file = __FILE__, \ 2bcd521a Steven Rostedt 2008-11-21 169 .line = __LINE__, \ 2bcd521a Steven Rostedt 2008-11-21 170 }; \ 2bcd521a Steven Rostedt 2008-11-21 171 ______r = !!(cond); \ :::::: The code at line 163 was first introduced by commit :::::: 2bcd521a684cc94befbe2ce7d5b613c841b0d304 trace: profile all if conditionals :::::: TO: Steven Rostedt <srostedt@redhat.com> :::::: CC: Ingo Molnar <mingo@elte.hu> --- 0-DAY kernel test infrastructure Open Source Technology Center https://lists.01.org/pipermail/kbuild-all Intel Corporation
diff --git a/fs/fuse/file.c b/fs/fuse/file.c index 2401c5dabb2a..79e1a3a048a8 100644 --- a/fs/fuse/file.c +++ b/fs/fuse/file.c @@ -2172,7 +2172,7 @@ static int fuse_setlk(struct file *file, struct file_lock *fl, int flock) } /* Unlock on close is handled by the flush method */ - if (fl->fl_flags & FL_CLOSE) + if (fl->fl_flags & FL_CLOSE_POSIX == FL_CLOSE_POSIX) return 0; fuse_lk_fill(&args, file, fl, opcode, pid, flock, &inarg); diff --git a/fs/locks.c b/fs/locks.c index 26811321d39b..af2031a1fcff 100644 --- a/fs/locks.c +++ b/fs/locks.c @@ -2504,7 +2504,7 @@ locks_remove_flock(struct file *filp, struct file_lock_context *flctx) .fl_owner = filp, .fl_pid = current->tgid, .fl_file = filp, - .fl_flags = FL_FLOCK, + .fl_flags = FL_FLOCK | FL_CLOSE, .fl_type = F_UNLCK, .fl_end = OFFSET_MAX, }; diff --git a/include/linux/fs.h b/include/linux/fs.h index 2ba074328894..e964ae0a9c29 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -903,6 +903,8 @@ static inline struct file *get_file(struct file *f) #define FL_OFDLCK 1024 /* lock is "owned" by struct file */ #define FL_LAYOUT 2048 /* outstanding pNFS layout */ +#define FL_CLOSE_POSIX (FL_POSIX | FL_CLOSE) + /* * Special return value from posix_lock_file() and vfs_lock_file() for * asynchronous locking.
Set FL_CLOSE in fl_flags as in locks_remove_posix() when clearing locks. NFS will check for this flag to ensure an unlock is sent in a following patch. Fuse handles flock and posix locks differently for FL_CLOSE, and so requires a fixup to retain the existing behavior for flock. Signed-off-by: Benjamin Coddington <bcodding@redhat.com> --- fs/fuse/file.c | 2 +- fs/locks.c | 2 +- include/linux/fs.h | 2 ++ 3 files changed, 4 insertions(+), 2 deletions(-)