* Re: [Ksummit-discuss] [TECH TOPIC] Linux kernel SMB server (CIFSD)
2019-07-24 10:50 ` Amir Goldstein
@ 2019-07-24 10:55 ` Jeff Layton
2019-07-25 5:00 ` Sergey Senozhatsky
2019-07-30 16:55 ` Jan Kara
2019-07-24 11:28 ` Sergey Senozhatsky
2019-07-24 16:42 ` Al Viro
2 siblings, 2 replies; 11+ messages in thread
From: Jeff Layton @ 2019-07-24 10:55 UTC (permalink / raw)
To: Amir Goldstein, Sergey Senozhatsky; +Cc: Trond Myklebust, ksummit-discuss
On Wed, 2019-07-24 at 13:50 +0300, Amir Goldstein wrote:
> On Wed, Jul 24, 2019 at 11:03 AM Sergey Senozhatsky
> <sergey.senozhatsky.work@gmail.com> wrote:
> > On (07/24/19 14:52), Sergey Senozhatsky wrote:
> > > On (05/30/19 01:59), Theodore Ts'o wrote:
> > > > From: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
> > [..]
> > > To extend the topic with some discussion points:
> > >
> > > - We are facing a rather familiar problem. Basically, SMB2 CHANGE_NOTIFY
> > > [1] is something what fsnotify normally does, except that we can't use
> > > it in cifsd kernel module. I see that NFS guys had [2] same issues some
> > > time ago.
> > >
> > > So the question is - how to do fs notify style monitoring in a kernel
> > > module (nfsd, cifsd)? Any chance the kernel can start exporting fsnotify
> > > symbols?
>
> I don't see a problem with exporting those symbols.
> As a matter of fact, I have a plan to use them also from overlayfs.
> At the time that Jeff posted his patches, there was no active fsnotify
> maintainer.
> Jeff, did you abandon this effort for nfsd?
>
(cc'ing Trond)
Trond has been driving those patches more recently. He posted a revised
set of them recently, and they still use fsnotify to detect unlink
activity:
https://www.spinics.net/lists/linux-nfs/msg73692.html
> > I even looked at LSM hooks, because they do what we need - invoke
> > creat, open, truncate, chmod, chown, unlink, callbacks. But, first,
> > I do realize that LSM was not meant to be used as some sort of fsnotify
> > replacement, and, second, LSM symbols are not exported anyway :)
> >
>
> fsnotify could actually be called from LSM hooks, see:
> https://github.com/amir73il/linux/commits/fsnotify_dirent_perm
>
> It may or may not be clear to you, but what you get extra from fsnotify
> compared to using bare LSM hooks is:
> - Minimal performance overhead for a non-marked object
> - Ability to subscribe/unsubscribe to certain events dynamically
> - Manage multiple subscriber instances (groups), like one per SMB session
> - Queuing infrastructure for async events if you need it
--
Jeff Layton <jlayton@kernel.org>
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [Ksummit-discuss] [TECH TOPIC] Linux kernel SMB server (CIFSD)
2019-07-24 10:55 ` Jeff Layton
@ 2019-07-25 5:00 ` Sergey Senozhatsky
2019-07-30 17:01 ` Jan Kara
2019-07-30 16:55 ` Jan Kara
1 sibling, 1 reply; 11+ messages in thread
From: Sergey Senozhatsky @ 2019-07-25 5:00 UTC (permalink / raw)
To: Jan Kara; +Cc: ksummit-discuss, Amir Goldstein, Jeff Layton, Trond Myklebust
On (07/24/19 06:55), Jeff Layton wrote:
> (cc'ing Trond)
>
> Trond has been driving those patches more recently. He posted a revised
> set of them recently, and they still use fsnotify to detect unlink
> activity:
>
> https://www.spinics.net/lists/linux-nfs/msg73692.html
Jan, do you have objections?
Would be great to have fsnotify export patch in linux-next, maybe.
-ss
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [Ksummit-discuss] [TECH TOPIC] Linux kernel SMB server (CIFSD)
2019-07-25 5:00 ` Sergey Senozhatsky
@ 2019-07-30 17:01 ` Jan Kara
2019-07-31 3:09 ` Sergey Senozhatsky
0 siblings, 1 reply; 11+ messages in thread
From: Jan Kara @ 2019-07-30 17:01 UTC (permalink / raw)
To: Sergey Senozhatsky
Cc: ksummit-discuss, Amir Goldstein, Jeff Layton, Trond Myklebust
On Thu 25-07-19 14:00:59, Sergey Senozhatsky wrote:
> On (07/24/19 06:55), Jeff Layton wrote:
> > (cc'ing Trond)
> >
> > Trond has been driving those patches more recently. He posted a revised
> > set of them recently, and they still use fsnotify to detect unlink
> > activity:
> >
> > https://www.spinics.net/lists/linux-nfs/msg73692.html
>
> Jan, do you have objections?
> Would be great to have fsnotify export patch in linux-next, maybe.
I have no objections to export bits of fsnotify to modules. After all
kernel/audit_tree.c is another external user of the fsnotify bits, just it
happens not to be modularized so there was never need for exports.
Once NFS guys (or someone else) have something that is close to inclusion,
I can push the export patch to my tree (just CC me, Amir, and fsdevel on the
series). I prefer not to export symbols for something that is out of tree
and will not be getting upstream in a near future. After all the export
patch is easy to carry in your tree if you need it.
Honza
--
Jan Kara <jack@suse.com>
SUSE Labs, CR
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [Ksummit-discuss] [TECH TOPIC] Linux kernel SMB server (CIFSD)
2019-07-30 17:01 ` Jan Kara
@ 2019-07-31 3:09 ` Sergey Senozhatsky
0 siblings, 0 replies; 11+ messages in thread
From: Sergey Senozhatsky @ 2019-07-31 3:09 UTC (permalink / raw)
To: Jan Kara; +Cc: ksummit-discuss, Amir Goldstein, Jeff Layton, Trond Myklebust
On (07/30/19 19:01), Jan Kara wrote:
> On Thu 25-07-19 14:00:59, Sergey Senozhatsky wrote:
> > On (07/24/19 06:55), Jeff Layton wrote:
> > > (cc'ing Trond)
> > >
> > > Trond has been driving those patches more recently. He posted a revised
> > > set of them recently, and they still use fsnotify to detect unlink
> > > activity:
> > >
> > > https://www.spinics.net/lists/linux-nfs/msg73692.html
> >
> > Jan, do you have objections?
> > Would be great to have fsnotify export patch in linux-next, maybe.
>
> I have no objections to export bits of fsnotify to modules. After all
> kernel/audit_tree.c is another external user of the fsnotify bits, just it
> happens not to be modularized so there was never need for exports.
That's great. At least we can expect that fsnotify will be exported
at some point and can start playing with fsnotify-based smb2_notify
implementation.
> Once NFS guys (or someone else) have something that is close to inclusion,
> I can push the export patch to my tree (just CC me, Amir, and fsdevel on the
> series).
OK, both OverlayFS and NFS have some plans for fsnotify, so let's see.
> I prefer not to export symbols for something that is out of tree
> and will not be getting upstream in a near future. After all the export
> patch is easy to carry in your tree if you need it.
Makes perfect sense.
-ss
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [Ksummit-discuss] [TECH TOPIC] Linux kernel SMB server (CIFSD)
2019-07-24 10:55 ` Jeff Layton
2019-07-25 5:00 ` Sergey Senozhatsky
@ 2019-07-30 16:55 ` Jan Kara
1 sibling, 0 replies; 11+ messages in thread
From: Jan Kara @ 2019-07-30 16:55 UTC (permalink / raw)
To: Jeff Layton; +Cc: ksummit-discuss, Amir Goldstein, Trond Myklebust
On Wed 24-07-19 06:55:53, Jeff Layton wrote:
> On Wed, 2019-07-24 at 13:50 +0300, Amir Goldstein wrote:
> > On Wed, Jul 24, 2019 at 11:03 AM Sergey Senozhatsky
> > <sergey.senozhatsky.work@gmail.com> wrote:
> > > On (07/24/19 14:52), Sergey Senozhatsky wrote:
> > > > On (05/30/19 01:59), Theodore Ts'o wrote:
> > > > > From: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
> > > [..]
> > > > To extend the topic with some discussion points:
> > > >
> > > > - We are facing a rather familiar problem. Basically, SMB2 CHANGE_NOTIFY
> > > > [1] is something what fsnotify normally does, except that we can't use
> > > > it in cifsd kernel module. I see that NFS guys had [2] same issues some
> > > > time ago.
> > > >
> > > > So the question is - how to do fs notify style monitoring in a kernel
> > > > module (nfsd, cifsd)? Any chance the kernel can start exporting fsnotify
> > > > symbols?
> >
> > I don't see a problem with exporting those symbols.
> > As a matter of fact, I have a plan to use them also from overlayfs.
> > At the time that Jeff posted his patches, there was no active fsnotify
> > maintainer.
> > Jeff, did you abandon this effort for nfsd?
> >
>
> (cc'ing Trond)
>
> Trond has been driving those patches more recently. He posted a revised
> set of them recently, and they still use fsnotify to detect unlink
> activity:
>
> https://www.spinics.net/lists/linux-nfs/msg73692.html
The fsnotify export bits look sane to me except perhaps
fsnotify_put_group() and fsnotify_wait_marks_destroyed(). Their usage in
"[PATCH 05/16] nfsd: add a new struct file caching facility to nfsd" looks
buggy AFAICT. One is supposed to destroy a group with
fsnotify_destroy_group() instead of just dropping the group reference (that
does just the final cleanup but expects fsnotify_destroy_group() has been
already called).
Honza
--
Jan Kara <jack@suse.com>
SUSE Labs, CR
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [Ksummit-discuss] [TECH TOPIC] Linux kernel SMB server (CIFSD)
2019-07-24 10:50 ` Amir Goldstein
2019-07-24 10:55 ` Jeff Layton
@ 2019-07-24 11:28 ` Sergey Senozhatsky
2019-07-24 16:42 ` Al Viro
2 siblings, 0 replies; 11+ messages in thread
From: Sergey Senozhatsky @ 2019-07-24 11:28 UTC (permalink / raw)
To: Amir Goldstein; +Cc: ksummit-discuss
On (07/24/19 13:50), Amir Goldstein wrote:
[..]
> I don't see a problem with exporting those symbols.
> As a matter of fact, I have a plan to use them also from overlayfs.
> At the time that Jeff posted his patches, there was no active fsnotify
> maintainer.
Cool.
> Jeff, did you abandon this effort for nfsd?
>
> >
> > I even looked at LSM hooks, because they do what we need - invoke
> > creat, open, truncate, chmod, chown, unlink, callbacks. But, first,
> > I do realize that LSM was not meant to be used as some sort of fsnotify
> > replacement, and, second, LSM symbols are not exported anyway :)
> >
>
> fsnotify could actually be called from LSM hooks, see:
> https://github.com/amir73il/linux/commits/fsnotify_dirent_perm
>
> It may or may not be clear to you, but what you get extra from fsnotify
> compared to using bare LSM hooks is:
Oh yeah, LSM does not really fit. I looked at it just out of curiosity.
> - Minimal performance overhead for a non-marked object
> - Ability to subscribe/unsubscribe to certain events dynamically
Absolutely, we need to "subscribe/unsubscribe dynamically".
> - Manage multiple subscriber instances (groups), like one per SMB session
We need this as well, you're right.
> - Queuing infrastructure for async events if you need it
-ss
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [Ksummit-discuss] [TECH TOPIC] Linux kernel SMB server (CIFSD)
2019-07-24 10:50 ` Amir Goldstein
2019-07-24 10:55 ` Jeff Layton
2019-07-24 11:28 ` Sergey Senozhatsky
@ 2019-07-24 16:42 ` Al Viro
2 siblings, 0 replies; 11+ messages in thread
From: Al Viro @ 2019-07-24 16:42 UTC (permalink / raw)
To: Amir Goldstein; +Cc: ksummit-discuss
On Wed, Jul 24, 2019 at 01:50:57PM +0300, Amir Goldstein wrote:
> On Wed, Jul 24, 2019 at 11:03 AM Sergey Senozhatsky
> <sergey.senozhatsky.work@gmail.com> wrote:
> >
> > On (07/24/19 14:52), Sergey Senozhatsky wrote:
> > > On (05/30/19 01:59), Theodore Ts'o wrote:
> > > > From: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
> > [..]
> > > To extend the topic with some discussion points:
> > >
> > > - We are facing a rather familiar problem. Basically, SMB2 CHANGE_NOTIFY
> > > [1] is something what fsnotify normally does, except that we can't use
> > > it in cifsd kernel module. I see that NFS guys had [2] same issues some
> > > time ago.
> > >
> > > So the question is - how to do fs notify style monitoring in a kernel
> > > module (nfsd, cifsd)? Any chance the kernel can start exporting fsnotify
> > > symbols?
>
> I don't see a problem with exporting those symbols.
> As a matter of fact, I have a plan to use them also from overlayfs.
> At the time that Jeff posted his patches, there was no active fsnotify
> maintainer.
> Jeff, did you abandon this effort for nfsd?
>
> >
> > I even looked at LSM hooks, because they do what we need - invoke
> > creat, open, truncate, chmod, chown, unlink, callbacks. But, first,
> > I do realize that LSM was not meant to be used as some sort of fsnotify
> > replacement, and, second, LSM symbols are not exported anyway :)
> >
>
> fsnotify could actually be called from LSM hooks, see:
> https://github.com/amir73il/linux/commits/fsnotify_dirent_perm
>
> It may or may not be clear to you, but what you get extra from fsnotify
> compared to using bare LSM hooks is:
> - Minimal performance overhead for a non-marked object
> - Ability to subscribe/unsubscribe to certain events dynamically
> - Manage multiple subscriber instances (groups), like one per SMB session
> - Queuing infrastructure for async events if you need it
.... and then there's the sad fact that LSM hooks have no well-defined
semantics and their coverage is... suboptimal, to put it very mildly.
^ permalink raw reply [flat|nested] 11+ messages in thread