提交 9e3fea16 编写于 作者: I Ian Kent 提交者: Al Viro

autofs4: Fix wait validation

It is possible for the check in wait.c:validate_request() to return
an incorrect result if the dentry that was mounted upon has changed
during the callback.
Signed-off-by: NIan Kent <raven@themaw.net>
Signed-off-by: NDavid Howells <dhowells@redhat.com>
Signed-off-by: NAl Viro <viro@zeniv.linux.org.uk>
上级 66511493
...@@ -309,6 +309,9 @@ static int validate_request(struct autofs_wait_queue **wait, ...@@ -309,6 +309,9 @@ static int validate_request(struct autofs_wait_queue **wait,
* completed while we waited on the mutex ... * completed while we waited on the mutex ...
*/ */
if (notify == NFY_MOUNT) { if (notify == NFY_MOUNT) {
struct dentry *new = NULL;
int valid = 1;
/* /*
* If the dentry was successfully mounted while we slept * If the dentry was successfully mounted while we slept
* on the wait queue mutex we can return success. If it * on the wait queue mutex we can return success. If it
...@@ -316,8 +319,20 @@ static int validate_request(struct autofs_wait_queue **wait, ...@@ -316,8 +319,20 @@ static int validate_request(struct autofs_wait_queue **wait,
* a multi-mount with no mount at it's base) we can * a multi-mount with no mount at it's base) we can
* continue on and create a new request. * continue on and create a new request.
*/ */
if (!IS_ROOT(dentry)) {
if (dentry->d_inode && d_unhashed(dentry)) {
struct dentry *parent = dentry->d_parent;
new = d_lookup(parent, &dentry->d_name);
if (new)
dentry = new;
}
}
if (have_submounts(dentry)) if (have_submounts(dentry))
return 0; valid = 0;
if (new)
dput(new);
return valid;
} }
return 1; return 1;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册