X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=fs%2Fexportfs%2Fexpfs.c;h=0a6f7b06b8d79edd33c1c722b1dd69ca9506d62b;hb=c7b5ebbddf7bcd3651947760f423e3783bbe6573;hp=c435e0a64a3f13a909688edd0e1400bb38597d1b;hpb=5273a3df6485dc2ad6aa7ddd441b9a21970f003b;p=linux-2.6.git diff --git a/fs/exportfs/expfs.c b/fs/exportfs/expfs.c index c435e0a64..0a6f7b06b 100644 --- a/fs/exportfs/expfs.c +++ b/fs/exportfs/expfs.c @@ -1,5 +1,6 @@ #include +#include #include #include #include @@ -155,11 +156,15 @@ find_exported_dentry(struct super_block *sb, void *obj, void *parent, if (!IS_ROOT(pd)) { /* must have found a connected parent - great */ + spin_lock(&pd->d_lock); pd->d_flags &= ~DCACHE_DISCONNECTED; + spin_unlock(&pd->d_lock); noprogress = 0; } else if (pd == sb->s_root) { printk(KERN_ERR "export: Eeek filesystem root is not connected, impossible\n"); + spin_lock(&pd->d_lock); pd->d_flags &= ~DCACHE_DISCONNECTED; + spin_unlock(&pd->d_lock); noprogress = 0; } else { /* we have hit the top of a disconnected path. Try @@ -278,7 +283,12 @@ find_exported_dentry(struct super_block *sb, void *obj, void *parent, /* drat - I just cannot find anything acceptable */ dput(result); - return ERR_PTR(-ESTALE); + /* It might be justifiable to return ESTALE here, + * but the filehandle at-least looks reasonable good + * and it just be a permission problem, so returning + * -EACCESS is safer + */ + return ERR_PTR(-EACCES); err_target: dput(target_dir); @@ -343,7 +353,7 @@ static int get_name(struct dentry *dentry, char *name, { struct inode *dir = dentry->d_inode; int error; - struct file file; + struct file *file; struct getdents_callback buffer; error = -ENOTDIR; @@ -355,11 +365,13 @@ static int get_name(struct dentry *dentry, char *name, /* * Open the directory ... */ - error = open_private_file(&file, dentry, O_RDONLY); - if (error) + file = dentry_open(dget(dentry), NULL, O_RDONLY); + error = PTR_ERR(file); + if (IS_ERR(file)) goto out; + error = -EINVAL; - if (!file.f_op->readdir) + if (!file->f_op->readdir) goto out_close; buffer.name = name; @@ -369,7 +381,7 @@ static int get_name(struct dentry *dentry, char *name, while (1) { int old_seq = buffer.sequence; - error = vfs_readdir(&file, filldir_one, &buffer); + error = vfs_readdir(file, filldir_one, &buffer); if (error < 0) break; @@ -383,7 +395,7 @@ static int get_name(struct dentry *dentry, char *name, } out_close: - close_private_file(&file); + fput(file); out: return error; }