* Re: [PATCH 3/4] locks: Set FL_CLOSE when removing flock locks on close()
[not found] ` <1487765584.2886.8.camel-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
@ 2017-02-22 12:25 ` Jeff Layton
[not found] ` <1487766356.2886.11.camel-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
0 siblings, 1 reply; 3+ messages in thread
From: Jeff Layton @ 2017-02-22 12:25 UTC (permalink / raw)
To: Benjamin Coddington, Trond Myklebust, Anna Schumaker
Cc: linux-nfs-u79uwXL29TY76Z2rM5mHXA,
linux-fsdevel-MogPR669STc76Z2rM5mHXA@public.gmane.org,
Miklos Szeredi
On Wed, 2017-02-22 at 07:13 -0500, Jeff Layton wrote:
> On Tue, 2017-02-21 at 10:39 -0500, 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.
> >
> > Signed-off-by: Benjamin Coddington <bcodding-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
> > ---
> > fs/locks.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > 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,
> > };
>
> Looks good. I'm fine with merging this one via the NFS tree, btw...
>
> Reviewed-by: Jeff Layton <jlayton-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
>
(cc'ing linux-fsdevel and Miklos)
Hmm, that said, this potentially may affect other filesystems. If you do
any more postings of this set, please cc linux-fsdevel.
In particular, I'll note that fuse has this:
/* Unlock on close is handled by the flush method */
if (fl->fl_flags & FL_CLOSE)
return 0;
I don't see any lock handling in fuse_flush (though it does pass down a
lockowner). I guess the expectation is that the userland driver should
close down POSIX locks when the flush method is called.
Miklos, does this also apply to flock locks? Would Ben's patch cause any
grief here?
Thanks,
--
Jeff Layton <jlayton-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH 3/4] locks: Set FL_CLOSE when removing flock locks on close()
[not found] ` <1487766356.2886.11.camel-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
@ 2017-02-22 13:25 ` Miklos Szeredi
[not found] ` <CAJfpegtArWuOKVS_Qq8E0Fw4pcsYC4sj==BN5=3WQSLDXA5AQg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
0 siblings, 1 reply; 3+ messages in thread
From: Miklos Szeredi @ 2017-02-22 13:25 UTC (permalink / raw)
To: Jeff Layton
Cc: Benjamin Coddington, Trond Myklebust, Anna Schumaker,
Linux NFS list,
linux-fsdevel-MogPR669STc76Z2rM5mHXA@public.gmane.org
On Wed, Feb 22, 2017 at 1:25 PM, Jeff Layton <jlayton-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org> wrote:
> On Wed, 2017-02-22 at 07:13 -0500, Jeff Layton wrote:
>> On Tue, 2017-02-21 at 10:39 -0500, 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.
>> >
>> > Signed-off-by: Benjamin Coddington <bcodding-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
>> > ---
>> > fs/locks.c | 2 +-
>> > 1 file changed, 1 insertion(+), 1 deletion(-)
>> >
>> > 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,
>> > };
>>
>> Looks good. I'm fine with merging this one via the NFS tree, btw...
>>
>> Reviewed-by: Jeff Layton <jlayton-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
>>
>
> (cc'ing linux-fsdevel and Miklos)
>
> Hmm, that said, this potentially may affect other filesystems. If you do
> any more postings of this set, please cc linux-fsdevel.
>
> In particular, I'll note that fuse has this:
>
> /* Unlock on close is handled by the flush method */
> if (fl->fl_flags & FL_CLOSE)
> return 0;
>
> I don't see any lock handling in fuse_flush (though it does pass down a
> lockowner). I guess the expectation is that the userland driver should
> close down POSIX locks when the flush method is called.
Right.
>
> Miklos, does this also apply to flock locks? Would Ben's patch cause any
> grief here?
Yes, it would make the final close of file not unlock flocks on that open file.
Simple fix is to change that condition to
#define FL_CLOSE_POSIX (FL_POSIX | FL_CLOSE)
if (fl->fl_flags & FL_CLOSE_POSIX == FL_CLOSE_POSIX)
return 0;
Thanks,
Miklos
--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH 3/4] locks: Set FL_CLOSE when removing flock locks on close()
[not found] ` <CAJfpegtArWuOKVS_Qq8E0Fw4pcsYC4sj==BN5=3WQSLDXA5AQg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2017-02-22 13:27 ` Benjamin Coddington
0 siblings, 0 replies; 3+ messages in thread
From: Benjamin Coddington @ 2017-02-22 13:27 UTC (permalink / raw)
To: Miklos Szeredi, Jeff Layton
Cc: Trond Myklebust, Anna Schumaker, Linux NFS list,
linux-fsdevel-MogPR669STc76Z2rM5mHXA@public.gmane.org
On 22 Feb 2017, at 8:25, Miklos Szeredi wrote:
> On Wed, Feb 22, 2017 at 1:25 PM, Jeff Layton <jlayton-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
> wrote:
>> On Wed, 2017-02-22 at 07:13 -0500, Jeff Layton wrote:
>>> On Tue, 2017-02-21 at 10:39 -0500, 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.
>>>>
>>>> Signed-off-by: Benjamin Coddington <bcodding-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
>>>> ---
>>>> fs/locks.c | 2 +-
>>>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>>>
>>>> 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,
>>>> };
>>>
>>> Looks good. I'm fine with merging this one via the NFS tree, btw...
>>>
>>> Reviewed-by: Jeff Layton <jlayton-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
>>>
>>
>> (cc'ing linux-fsdevel and Miklos)
>>
>> Hmm, that said, this potentially may affect other filesystems. If you
>> do
>> any more postings of this set, please cc linux-fsdevel.
>>
>> In particular, I'll note that fuse has this:
>>
>> /* Unlock on close is handled by the flush method */
>> if (fl->fl_flags & FL_CLOSE)
>> return 0;
>>
>> I don't see any lock handling in fuse_flush (though it does pass down
>> a
>> lockowner). I guess the expectation is that the userland driver
>> should
>> close down POSIX locks when the flush method is called.
>
> Right.
>
>>
>> Miklos, does this also apply to flock locks? Would Ben's patch cause
>> any
>> grief here?
>
> Yes, it would make the final close of file not unlock flocks on that
> open file.
>
> Simple fix is to change that condition to
>
> #define FL_CLOSE_POSIX (FL_POSIX | FL_CLOSE)
>
> if (fl->fl_flags & FL_CLOSE_POSIX == FL_CLOSE_POSIX)
> return 0;
OK, I can that in the next version. Thanks for that catch Jeff.
Ben
--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-02-22 13:27 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <cover.1487691345.git.bcodding@redhat.com>
[not found] ` <c43ab767372bd73a60a4e1c97b39bb6fc0722590.1487691345.git.bcodding@redhat.com>
[not found] ` <1487765584.2886.8.camel@redhat.com>
[not found] ` <1487765584.2886.8.camel-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2017-02-22 12:25 ` [PATCH 3/4] locks: Set FL_CLOSE when removing flock locks on close() Jeff Layton
[not found] ` <1487766356.2886.11.camel-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2017-02-22 13:25 ` Miklos Szeredi
[not found] ` <CAJfpegtArWuOKVS_Qq8E0Fw4pcsYC4sj==BN5=3WQSLDXA5AQg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-02-22 13:27 ` Benjamin Coddington
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).