[linux-cifs-client] cifs: wrap cifs_dnotify_thread in CONFIG_BROKEN
diff mbox

Message ID 1232642078-9717-1-git-send-email-jlayton@redhat.com
State New, archived
Headers show

Commit Message

Jeff Layton Jan. 22, 2009, 4:34 p.m. UTC
This thread never actually did anything useful, so comment it out by
#ifdef'ing it in CONFIG_BROKEN. My preference would be to remove it
altogether, but it's not my call.

Signed-off-by: Jeff Layton <jlayton@redhat.com>
---
 fs/cifs/cifsfs.c |   13 ++++++-------
 1 files changed, 6 insertions(+), 7 deletions(-)

Comments

Christoph Hellwig Jan. 22, 2009, 9:06 p.m. UTC | #1
On Thu, Jan 22, 2009 at 11:34:38AM -0500, Jeff Layton wrote:
> This thread never actually did anything useful, so comment it out by
> #ifdef'ing it in CONFIG_BROKEN. My preference would be to remove it
> altogether, but it's not my call.

Please just kill it.  It's not only useless but also ugly, so keeping it
around it a double disservice to the mother nature.
Steve French Jan. 22, 2009, 11:13 p.m. UTC | #2
The thread may be renamed/rewritten etc. - but we badly need to finish
the dnotify / inotify code ... removing the start on this that someone
wrote in the past isn't getting us any closer to this.

dnotify/inotify support was added to Linux in the first place because
Samba used it to handle this common operation (it is commonly used by
OTHER cifs clients) ... but none of the Linux cluster/network file
systems have had time to finish the code ... we need to finish this -
the network protocol portion of this is now well documented (and we
presumably will need a thread to process the dnotify multishot
notification responses so we don't clog up the demultiplex thread
waiting on kde and gnoe)

On Thu, Jan 22, 2009 at 3:06 PM, Christoph Hellwig <hch@infradead.org> wrote:
> On Thu, Jan 22, 2009 at 11:34:38AM -0500, Jeff Layton wrote:
>> This thread never actually did anything useful, so comment it out by
>> #ifdef'ing it in CONFIG_BROKEN. My preference would be to remove it
>> altogether, but it's not my call.
>
> Please just kill it.  It's not only useless but also ugly, so keeping it
> around it a double disservice to the mother nature.
>
>
Jeff Layton Jan. 22, 2009, 11:31 p.m. UTC | #3
On Thu, 22 Jan 2009 17:13:37 -0600
Steve French <smfrench@gmail.com> wrote:

> The thread may be renamed/rewritten etc. - but we badly need to finish
> the dnotify / inotify code ... removing the start on this that someone
> wrote in the past isn't getting us any closer to this.
> 
> dnotify/inotify support was added to Linux in the first place because
> Samba used it to handle this common operation (it is commonly used by
> OTHER cifs clients) ... but none of the Linux cluster/network file
> systems have had time to finish the code ... we need to finish this -
> the network protocol portion of this is now well documented (and we
> presumably will need a thread to process the dnotify multishot
> notification responses so we don't clog up the demultiplex thread
> waiting on kde and gnoe)
> 

Removing this kthread won't measurably move us farther away from that
goal either.

It's currently under CONFIG_CIFS_EXPERIMENTAL, which would be fine if
it actually did something. It doesn't though -- it just wakes up tasks
that don't need to be woken up.

I have no issue with a kthread that does useful work, but why not remove
this kthread out of the mainline code for now and just plan to put it
back when it actually has something useful to do?

The patch that removes it will live in perpetuity in git. It'll be a
trivial matter to revert it when you're ready to have the kthread do
real work.
Steve French Jan. 22, 2009, 11:41 p.m. UTC | #4
IIRC ... the original suggestion that was made and partially
implemented a few years ago (code was disabled at runtime, not just
wrapped in an ifdef originally) was that cifs_demultiplex_thread would
take the incoming responses from the server for cifs multishot notify
smbs and queue them to a dnotify queue.   The cifs dnotify thread was
inteneded to -- only -- process the items in the dnotify queue, parse
the response to see which of the inline worker functions (in
include/linux/fsnotify.h e.g. fsnotify_create) ineeds to be called,
check if we have a dnotify or inotify for the corresponding inode and
call the generic hook (e.g. fsnotify_d_move or fsnotify_nameremove or
fsnotify_create etc.).   Adding something like that back in would be
easy enough and wrapping inside an ifdef ... but the people who
understand more about inotify presumably don't know about CIFS or SMB2
etc. so it is not likely to be implemented as one step ... but needs
to be staged in.

On Thu, Jan 22, 2009 at 5:31 PM, Jeff Layton <jlayton@redhat.com> wrote:
> On Thu, 22 Jan 2009 17:13:37 -0600
> Steve French <smfrench@gmail.com> wrote:
>
>> The thread may be renamed/rewritten etc. - but we badly need to finish
>> the dnotify / inotify code ... removing the start on this that someone
>> wrote in the past isn't getting us any closer to this.
>>
>> dnotify/inotify support was added to Linux in the first place because
>> Samba used it to handle this common operation (it is commonly used by
>> OTHER cifs clients) ... but none of the Linux cluster/network file
>> systems have had time to finish the code ... we need to finish this -
>> the network protocol portion of this is now well documented (and we
>> presumably will need a thread to process the dnotify multishot
>> notification responses so we don't clog up the demultiplex thread
>> waiting on kde and gnoe)
>>
>
> Removing this kthread won't measurably move us farther away from that
> goal either.
>
> It's currently under CONFIG_CIFS_EXPERIMENTAL, which would be fine if
> it actually did something. It doesn't though -- it just wakes up tasks
> that don't need to be woken up.
>
> I have no issue with a kthread that does useful work, but why not remove
> this kthread out of the mainline code for now and just plan to put it
> back when it actually has something useful to do?
>
> The patch that removes it will live in perpetuity in git. It'll be a
> trivial matter to revert it when you're ready to have the kthread do
> real work.
>
> --
> Jeff Layton <jlayton@redhat.com>
>
Steve French Jan. 22, 2009, 11:56 p.m. UTC | #5
One of the obvious reasons that we could throw away the idea of a cifs
dnotify thread for cifs is if we could guarantee that all of the
functions in include/linux/fsnotify.h are nonblocking.  If the
fsnotify.h worker functions are nonblocking then we could safely
process all of the notify responses in cifs_demultiplex_thread (since
we wouldn't have to queue them) without clogging up response
processing for the socket.   Note that notify responses are unusual -
they don't have an application thread waiting on them ("multishot"
responses) typically (there is only one other type of SMB response
that does not have an application thread associated with it).

On Thu, Jan 22, 2009 at 5:41 PM, Steve French <smfrench@gmail.com> wrote:
> IIRC ... the original suggestion that was made and partially
> implemented a few years ago (code was disabled at runtime, not just
> wrapped in an ifdef originally) was that cifs_demultiplex_thread would
> take the incoming responses from the server for cifs multishot notify
> smbs and queue them to a dnotify queue.   The cifs dnotify thread was
> inteneded to -- only -- process the items in the dnotify queue, parse
> the response to see which of the inline worker functions (in
> include/linux/fsnotify.h e.g. fsnotify_create) ineeds to be called,
> check if we have a dnotify or inotify for the corresponding inode and
> call the generic hook (e.g. fsnotify_d_move or fsnotify_nameremove or
> fsnotify_create etc.).   Adding something like that back in would be
> easy enough and wrapping inside an ifdef ... but the people who
> understand more about inotify presumably don't know about CIFS or SMB2
> etc. so it is not likely to be implemented as one step ... but needs
> to be staged in.
>
> On Thu, Jan 22, 2009 at 5:31 PM, Jeff Layton <jlayton@redhat.com> wrote:
>> On Thu, 22 Jan 2009 17:13:37 -0600
>> Steve French <smfrench@gmail.com> wrote:
>>
>>> The thread may be renamed/rewritten etc. - but we badly need to finish
>>> the dnotify / inotify code ... removing the start on this that someone
>>> wrote in the past isn't getting us any closer to this.
>>>
>>> dnotify/inotify support was added to Linux in the first place because
>>> Samba used it to handle this common operation (it is commonly used by
>>> OTHER cifs clients) ... but none of the Linux cluster/network file
>>> systems have had time to finish the code ... we need to finish this -
>>> the network protocol portion of this is now well documented (and we
>>> presumably will need a thread to process the dnotify multishot
>>> notification responses so we don't clog up the demultiplex thread
>>> waiting on kde and gnoe)
>>>
>>
>> Removing this kthread won't measurably move us farther away from that
>> goal either.
>>
>> It's currently under CONFIG_CIFS_EXPERIMENTAL, which would be fine if
>> it actually did something. It doesn't though -- it just wakes up tasks
>> that don't need to be woken up.
>>
>> I have no issue with a kthread that does useful work, but why not remove
>> this kthread out of the mainline code for now and just plan to put it
>> back when it actually has something useful to do?
>>
>> The patch that removes it will live in perpetuity in git. It'll be a
>> trivial matter to revert it when you're ready to have the kthread do
>> real work.
>>
>> --
>> Jeff Layton <jlayton@redhat.com>
>>
>
>
>
> --
> Thanks,
>
> Steve
>
Christoph Hellwig Jan. 23, 2009, 12:13 a.m. UTC | #6
On Thu, Jan 22, 2009 at 06:31:15PM -0500, Jeff Layton wrote:
> Removing this kthread won't measurably move us farther away from that
> goal either.
> 
> It's currently under CONFIG_CIFS_EXPERIMENTAL, which would be fine if
> it actually did something. It doesn't though -- it just wakes up tasks
> that don't need to be woken up.
> 
> I have no issue with a kthread that does useful work, but why not remove
> this kthread out of the mainline code for now and just plan to put it
> back when it actually has something useful to do?
> 
> The patch that removes it will live in perpetuity in git. It'll be a
> trivial matter to revert it when you're ready to have the kthread do
> real work.

Yeah.  Currently it's useless code.  If a proper *notify implementation
for cifs still needs a thread it can be added with that implementation,
and I'm sure it'll look very different from the current one (at least
after review..)
Jeff Layton Jan. 23, 2009, 1:17 a.m. UTC | #7
On Thu, 22 Jan 2009 17:56:09 -0600
Steve French <smfrench@gmail.com> wrote:

> One of the obvious reasons that we could throw away the idea of a cifs
> dnotify thread for cifs is if we could guarantee that all of the
> functions in include/linux/fsnotify.h are nonblocking.  If the
> fsnotify.h worker functions are nonblocking then we could safely
> process all of the notify responses in cifs_demultiplex_thread (since
> we wouldn't have to queue them) without clogging up response
> processing for the socket.   Note that notify responses are unusual -
> they don't have an application thread waiting on them ("multishot"
> responses) typically (there is only one other type of SMB response
> that does not have an application thread associated with it).
> 

I'm not arguing against the need for a kthread to handle notifications.
Heck, I'm even ok with more than one thread if it's necessary.

We simply don't have such an implementation today. Until we do, this
kthread is just dead weight. There's simply no need to keep this in
place until we have working code that uses it.

Patch
diff mbox

diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c
index 13ea532..5a9ed5f 100644
--- a/fs/cifs/cifsfs.c
+++ b/fs/cifs/cifsfs.c
@@ -65,9 +65,8 @@  unsigned int extended_security = CIFSSEC_DEF;
 unsigned int sign_CIFS_PDUs = 1;
 extern struct task_struct *oplockThread; /* remove sparse warning */
 struct task_struct *oplockThread = NULL;
-/* extern struct task_struct * dnotifyThread; remove sparse warning */
-#ifdef CONFIG_CIFS_EXPERIMENTAL
-static struct task_struct *dnotifyThread = NULL;
+#ifdef CONFIG_BROKEN
+static struct task_struct *dnotifyThread;
 #endif
 static const struct super_operations cifs_super_ops;
 unsigned int CIFSMaxBufSize = CIFS_MAX_MSGSIZE;
@@ -1039,7 +1038,7 @@  static int cifs_oplock_thread(void *dummyarg)
 	return 0;
 }
 
-#ifdef CONFIG_CIFS_EXPERIMENTAL
+#ifdef CONFIG_BROKEN
 static int cifs_dnotify_thread(void *dummyarg)
 {
 	struct list_head *tmp;
@@ -1143,7 +1142,7 @@  init_cifs(void)
 		goto out_unregister_dfs_key_type;
 	}
 
-#ifdef CONFIG_CIFS_EXPERIMENTAL
+#ifdef CONFIG_BROKEN
 	dnotifyThread = kthread_run(cifs_dnotify_thread, NULL, "cifsdnotifyd");
 	if (IS_ERR(dnotifyThread)) {
 		rc = PTR_ERR(dnotifyThread);
@@ -1154,7 +1153,7 @@  init_cifs(void)
 
 	return 0;
 
-#ifdef CONFIG_CIFS_EXPERIMENTAL
+#ifdef CONFIG_BROKEN
  out_stop_oplock_thread:
 #endif
 	kthread_stop(oplockThread);
@@ -1195,7 +1194,7 @@  exit_cifs(void)
 	cifs_destroy_inodecache();
 	cifs_destroy_mids();
 	cifs_destroy_request_bufs();
-#ifdef CONFIG_CIFS_EXPERIMENTAL
+#ifdef CONFIG_BROKEN
 	kthread_stop(dnotifyThread);
 #endif
 	kthread_stop(oplockThread);