* [PATCH] autofs4 - follow_link missing funtionality
@ 2006-03-10 12:08 Ian Kent
2006-03-10 22:50 ` Andrew Morton
0 siblings, 1 reply; 4+ messages in thread
From: Ian Kent @ 2006-03-10 12:08 UTC (permalink / raw)
To: Andrew Morton; +Cc: autofs mailing list, Kernel Mailing List, linux-fsdevel
This functionality is also need for operation of autofs v5 direct mounts.
Signed-off-by: Ian Kent <raven@themaw.net>
---
--- linux-2.6.16-rc5-mm3/fs/autofs4/root.c.follow_link-ommission 2006-03-08 13:21:37.000000000 +0800
+++ linux-2.6.16-rc5-mm3/fs/autofs4/root.c 2006-03-08 13:27:47.000000000 +0800
@@ -57,6 +57,9 @@ struct inode_operations autofs4_indirect
struct inode_operations autofs4_direct_root_inode_operations = {
.lookup = autofs4_lookup,
+ .unlink = autofs4_dir_unlink,
+ .mkdir = autofs4_dir_mkdir,
+ .rmdir = autofs4_dir_rmdir,
.follow_link = autofs4_follow_link,
};
@@ -337,10 +340,34 @@ static void *autofs4_follow_link(struct
if (oz_mode || !lookup_type)
goto done;
+ /*
+ * If the dentry contains directories then it is an
+ * autofs multi-mount with no root offset. So don't
+ * try to mount it again.
+ */
+ spin_lock(&dcache_lock);
+ if (!list_empty(&dentry->d_subdirs)) {
+ spin_unlock(&dcache_lock);
+ goto done;
+ }
+ spin_unlock(&dcache_lock);
+
status = try_to_fill_dentry(dentry, 0);
if (status)
goto out_error;
+ /*
+ * The mount succeeded but if there is no root mount
+ * and directories have been created then it must
+ * be an autofs multi-mount with no root offset.
+ */
+ spin_lock(&dcache_lock);
+ if (!d_mountpoint(dentry) && !list_empty(&dentry->d_subdirs)) {
+ spin_unlock(&dcache_lock);
+ goto done;
+ }
+ spin_unlock(&dcache_lock);
+
if (!autofs4_follow_mount(&nd->mnt, &nd->dentry)) {
status = -ENOENT;
goto out_error;
--- linux-2.6.16-rc5-mm3/fs/autofs4/expire.c.follow_link-ommission 2006-03-08 14:18:25.000000000 +0800
+++ linux-2.6.16-rc5-mm3/fs/autofs4/expire.c 2006-03-08 13:28:21.000000000 +0800
@@ -113,10 +113,6 @@ static int autofs4_direct_busy(struct vf
DPRINTK("top %p %.*s",
top, (int) top->d_name.len, top->d_name.name);
- /* Not a mountpoint - give up */
- if (!d_mountpoint(top))
- return 1;
-
/* If it's busy update the expiry counters */
if (!may_umount_tree(mnt)) {
struct autofs_info *ino = autofs4_dentry_ino(top);
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] autofs4 - follow_link missing funtionality
2006-03-10 12:08 [PATCH] autofs4 - follow_link missing funtionality Ian Kent
@ 2006-03-10 22:50 ` Andrew Morton
2006-03-11 14:10 ` Ian Kent
2006-03-26 11:51 ` Ian Kent
0 siblings, 2 replies; 4+ messages in thread
From: Andrew Morton @ 2006-03-10 22:50 UTC (permalink / raw)
To: Ian Kent; +Cc: autofs, linux-kernel, linux-fsdevel
Ian Kent <raven@themaw.net> wrote:
>
> @@ -337,10 +340,34 @@ static void *autofs4_follow_link(struct
> if (oz_mode || !lookup_type)
> goto done;
>
> + /*
> + * If the dentry contains directories then it is an
> + * autofs multi-mount with no root offset. So don't
> + * try to mount it again.
> + */
> + spin_lock(&dcache_lock);
> + if (!list_empty(&dentry->d_subdirs)) {
> + spin_unlock(&dcache_lock);
> + goto done;
> + }
> + spin_unlock(&dcache_lock);
> +
Can list_empty(&dentry->d_subdirs) become false right here, after the lock
was dropped? If so, what happens?
> status = try_to_fill_dentry(dentry, 0);
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] autofs4 - follow_link missing funtionality
2006-03-10 22:50 ` Andrew Morton
@ 2006-03-11 14:10 ` Ian Kent
2006-03-26 11:51 ` Ian Kent
1 sibling, 0 replies; 4+ messages in thread
From: Ian Kent @ 2006-03-11 14:10 UTC (permalink / raw)
To: Andrew Morton; +Cc: autofs, linux-kernel, linux-fsdevel
On Fri, 10 Mar 2006, Andrew Morton wrote:
> Ian Kent <raven@themaw.net> wrote:
> >
> > @@ -337,10 +340,34 @@ static void *autofs4_follow_link(struct
> > if (oz_mode || !lookup_type)
> > goto done;
> >
> > + /*
> > + * If the dentry contains directories then it is an
> > + * autofs multi-mount with no root offset. So don't
> > + * try to mount it again.
> > + */
> > + spin_lock(&dcache_lock);
> > + if (!list_empty(&dentry->d_subdirs)) {
> > + spin_unlock(&dcache_lock);
> > + goto done;
> > + }
> > + spin_unlock(&dcache_lock);
> > +
>
> Can list_empty(&dentry->d_subdirs) become false right here, after the lock
> was dropped? If so, what happens?
Yep. I think so.
Not what I want to happen.
>
>
> > status = try_to_fill_dentry(dentry, 0);
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] autofs4 - follow_link missing funtionality
2006-03-10 22:50 ` Andrew Morton
2006-03-11 14:10 ` Ian Kent
@ 2006-03-26 11:51 ` Ian Kent
1 sibling, 0 replies; 4+ messages in thread
From: Ian Kent @ 2006-03-26 11:51 UTC (permalink / raw)
To: Andrew Morton; +Cc: autofs, linux-kernel, linux-fsdevel
Hi Andrew,
Here is an update to this patch to address your concern below.
Basicly, I wait for pending operations to complete, the main concern is an
expire operation causing directories to be removed. As we hold a reference
to the vfsmount and the dentry that shouldn't happen once any that are in
progress have completed.
At least that's what I expect.
On Fri, 10 Mar 2006, Andrew Morton wrote:
> Ian Kent <raven@themaw.net> wrote:
> >
> > @@ -337,10 +340,34 @@ static void *autofs4_follow_link(struct
> > if (oz_mode || !lookup_type)
> > goto done;
> >
> > + /*
> > + * If the dentry contains directories then it is an
> > + * autofs multi-mount with no root offset. So don't
> > + * try to mount it again.
> > + */
> > + spin_lock(&dcache_lock);
> > + if (!list_empty(&dentry->d_subdirs)) {
> > + spin_unlock(&dcache_lock);
> > + goto done;
> > + }
> > + spin_unlock(&dcache_lock);
> > +
>
> Can list_empty(&dentry->d_subdirs) become false right here, after the lock
> was dropped? If so, what happens?
>
>
> > status = try_to_fill_dentry(dentry, 0);
>
Signed-off-by: Ian Kent <raven@themaw.net>
--
--- linux-2.6.16-mm1/fs/autofs4/root.c.follow_link-expire-check 2006-03-24 12:32:16.000000000 +0800
+++ linux-2.6.16-mm1/fs/autofs4/root.c 2006-03-24 15:01:15.000000000 +0800
@@ -341,38 +341,49 @@ static void *autofs4_follow_link(struct
goto done;
/*
- * If the dentry contains directories then it is an
- * autofs multi-mount with no root offset. So don't
- * try to mount it again.
+ * If a request is pending wait for it.
+ * If it's a mount then it won't be expired till at least
+ * a liitle later and if it's an expire then we might need
+ * to mount it again.
*/
- spin_lock(&dcache_lock);
- if (!list_empty(&dentry->d_subdirs)) {
- spin_unlock(&dcache_lock);
- goto done;
- }
- spin_unlock(&dcache_lock);
+ if (autofs4_ispending(dentry)) {
+ DPRINTK("waiting for active request %p name=%.*s",
+ dentry, dentry->d_name.len, dentry->d_name.name);
- status = try_to_fill_dentry(dentry, 0);
- if (status)
- goto out_error;
+ status = autofs4_wait(sbi, dentry, NFY_NONE);
+
+ DPRINTK("request done status=%d", status);
+ }
/*
- * The mount succeeded but if there is no root mount
- * and directories have been created then it must
- * be an autofs multi-mount with no root offset.
+ * If the dentry contains directories then it is an
+ * autofs multi-mount with no root mount offset. So
+ * don't try to mount it again.
*/
spin_lock(&dcache_lock);
- if (!d_mountpoint(dentry) && !list_empty(&dentry->d_subdirs)) {
+ if (!d_mountpoint(dentry) && list_empty(&dentry->d_subdirs)) {
spin_unlock(&dcache_lock);
+
+ status = try_to_fill_dentry(dentry, 0);
+ if (status)
+ goto out_error;
+
+ /*
+ * The mount succeeded but if there is no root mount
+ * it must be an autofs multi-mount with no root offset
+ * so we don't need to follow the mount.
+ */
+ if (d_mountpoint(dentry)) {
+ if (!autofs4_follow_mount(&nd->mnt, &nd->dentry)) {
+ status = -ENOENT;
+ goto out_error;
+ }
+ }
+
goto done;
}
spin_unlock(&dcache_lock);
- if (!autofs4_follow_mount(&nd->mnt, &nd->dentry)) {
- status = -ENOENT;
- goto out_error;
- }
-
done:
return NULL;
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2006-03-26 11:50 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-03-10 12:08 [PATCH] autofs4 - follow_link missing funtionality Ian Kent
2006-03-10 22:50 ` Andrew Morton
2006-03-11 14:10 ` Ian Kent
2006-03-26 11:51 ` Ian Kent
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).