Commit 97519332 authored by Trond Myklebust's avatar Trond Myklebust

Fix problem with open(O_EXCL) not creating hashed dentries.

Problem analysis and fix provided by Andries Brouwer.
Cleanup of nfs_lookup() by me...
parent 3e9487c8
...@@ -672,36 +672,29 @@ static struct dentry *nfs_lookup(struct inode *dir, struct dentry * dentry, stru ...@@ -672,36 +672,29 @@ static struct dentry *nfs_lookup(struct inode *dir, struct dentry * dentry, stru
error = -ENOMEM; error = -ENOMEM;
dentry->d_op = &nfs_dentry_operations; dentry->d_op = &nfs_dentry_operations;
lock_kernel();
/* If we're doing an exclusive create, optimize away the lookup */ /* If we're doing an exclusive create, optimize away the lookup */
if (nfs_is_exclusive_create(dir, nd)) if (nfs_is_exclusive_create(dir, nd))
return NULL; goto no_entry;
lock_kernel();
error = nfs_cached_lookup(dir, dentry, &fhandle, &fattr); error = nfs_cached_lookup(dir, dentry, &fhandle, &fattr);
if (!error) { if (error != 0) {
error = -EACCES; error = NFS_PROTO(dir)->lookup(dir, &dentry->d_name,
inode = nfs_fhget(dentry, &fhandle, &fattr); &fhandle, &fattr);
if (inode) { if (error == -ENOENT)
d_add(dentry, inode); goto no_entry;
nfs_renew_times(dentry); if (error != 0)
error = 0; goto out_unlock;
}
goto out_unlock;
}
error = NFS_PROTO(dir)->lookup(dir, &dentry->d_name, &fhandle, &fattr);
if (error == -ENOENT)
goto no_entry;
if (!error) {
error = -EACCES;
inode = nfs_fhget(dentry, &fhandle, &fattr);
if (inode) {
no_entry:
d_add(dentry, inode);
error = 0;
}
nfs_renew_times(dentry);
} }
error = -EACCES;
inode = nfs_fhget(dentry, &fhandle, &fattr);
if (!inode)
goto out_unlock;
no_entry:
error = 0;
d_add(dentry, inode);
nfs_renew_times(dentry);
out_unlock: out_unlock:
unlock_kernel(); unlock_kernel();
out: out:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment