This commit is contained in:
Miklos Szeredi 2005-09-02 14:56:09 +00:00
parent 5648781882
commit 0716de0eed
3 changed files with 22 additions and 8 deletions

View File

@ -5,6 +5,8 @@
* Fix compile warning on 2.6.13 and later
* Fix compilation on 2.4.*
2005-08-25 Miklos Szeredi <miklos@szeredi.hu>
* lib: add userspace side of ftruncate() method for experimentation

View File

@ -476,6 +476,7 @@ static int fuse_revalidate(struct dentry *entry)
return fuse_do_getattr(inode);
}
#ifdef KERNEL_2_6
static int fuse_access(struct inode *inode, int mask)
{
struct fuse_conn *fc = get_fuse_conn(inode);
@ -507,6 +508,7 @@ static int fuse_access(struct inode *inode, int mask)
}
return err;
}
#endif
static int fuse_permission(struct inode *inode, int mask, struct nameidata *nd)
{
@ -552,8 +554,10 @@ static int fuse_permission(struct inode *inode, int mask, struct nameidata *nd)
return -EACCES;
err = 0;
#ifdef KERNEL_2_6
if (nd && (nd->flags & LOOKUP_ACCESS))
err = fuse_access(inode, mask);
#endif
}
return err;
}

View File

@ -685,17 +685,16 @@ static int fuse_getlk(struct file *file, struct file_lock *fl)
return err;
}
static int fuse_setlk(struct file *file, struct file_lock *fl)
static int fuse_setlk(struct file *file, struct file_lock *fl, int sleep)
{
struct inode *inode = file->f_dentry->d_inode;
struct fuse_conn *fc = get_fuse_conn(inode);
struct fuse_req *req;
struct fuse_lk_in_out arg;
int sleep = fl->fl_flags & FL_SLEEP;
int err;
if (fc->no_lk)
return posix_lock_file_wait(file, fl);
return -ENOSYS;
if (!sleep) {
req = fuse_get_request(fc);
@ -722,10 +721,8 @@ static int fuse_setlk(struct file *file, struct file_lock *fl)
request_send(fc, req);
err = req->out.h.error;
fuse_put_request(fc, req);
if (err == -ENOSYS) {
if (err == -ENOSYS)
fc->no_lk = 1;
err = posix_lock_file_wait(file, fl);
}
return err;
}
@ -734,8 +731,19 @@ static int fuse_file_lock(struct file *file, int cmd, struct file_lock *fl)
{
if (cmd == F_GETLK)
return fuse_getlk(file, fl);
else
return fuse_setlk(file, fl);
else {
#ifdef KERNEL_2_6
int err = fuse_setlk(file, fl, fl->fl_flags & FL_SLEEP);
if (err == -ENOSYS)
err = posix_lock_file_wait(file, fl);
#else
int err = fuse_setlk(file, fl,
cmd == F_SETLKW || cmd == F_SETLKW64);
if (err == -ENOSYS)
err = 0;
#endif
return err;
}
}
#ifndef KERNEL_2_6