summaryrefslogtreecommitdiffstats
path: root/drivers/staging/pohmelfs/dir.c
diff options
context:
space:
mode:
authorFrederic Weisbecker2009-10-18 01:09:09 +0200
committerFrederic Weisbecker2009-10-18 01:12:33 +0200
commit0f8f86c7bdd1c954fbe153af437a0d91a6c5721a (patch)
tree94a8d419a470a4f9852ca397bb9bbe48db92ff5c /drivers/staging/pohmelfs/dir.c
parentMerge branch 'linus' into tracing/hw-breakpoints (diff)
parentperf tools: Move dereference after NULL test (diff)
downloadkernel-qcow2-linux-0f8f86c7bdd1c954fbe153af437a0d91a6c5721a.tar.gz
kernel-qcow2-linux-0f8f86c7bdd1c954fbe153af437a0d91a6c5721a.tar.xz
kernel-qcow2-linux-0f8f86c7bdd1c954fbe153af437a0d91a6c5721a.zip
Merge commit 'perf/core' into perf/hw-breakpoint
Conflicts: kernel/Makefile kernel/trace/Makefile kernel/trace/trace.h samples/Makefile Merge reason: We need to be uptodate with the perf events development branch because we plan to rewrite the breakpoints API on top of perf events.
Diffstat (limited to 'drivers/staging/pohmelfs/dir.c')
-rw-r--r--drivers/staging/pohmelfs/dir.c27
1 files changed, 19 insertions, 8 deletions
diff --git a/drivers/staging/pohmelfs/dir.c b/drivers/staging/pohmelfs/dir.c
index 4c58e22c1fbe..6c5b261e9f06 100644
--- a/drivers/staging/pohmelfs/dir.c
+++ b/drivers/staging/pohmelfs/dir.c
@@ -352,7 +352,9 @@ static int pohmelfs_sync_remote_dir(struct pohmelfs_inode *pi)
test_bit(NETFS_INODE_REMOTE_DIR_SYNCED, &pi->state) || pi->error, ret);
dprintk("%s: awake dir: %llu, ret: %ld, err: %d.\n", __func__, pi->ino, ret, pi->error);
if (ret <= 0) {
- err = -ETIMEDOUT;
+ err = ret;
+ if (!err)
+ err = -ETIMEDOUT;
goto err_out_exit;
}
@@ -412,7 +414,7 @@ static int pohmelfs_readdir(struct file *file, void *dirent, filldir_t filldir)
__func__, file->f_pos, pi->ino, n->data, n->len,
n->ino, n->mode, mode, file->f_pos, n->hash);
- file->private_data = (void *)n->hash;
+ file->private_data = (void *)(unsigned long)n->hash;
len = n->len;
err = filldir(dirent, n->data, n->len, file->f_pos, n->ino, mode);
@@ -472,10 +474,11 @@ static int pohmelfs_lookup_single(struct pohmelfs_inode *parent,
err = 0;
ret = wait_event_interruptible_timeout(psb->wait,
!test_bit(NETFS_COMMAND_PENDING, &parent->state), ret);
- if (ret == 0)
- err = -ETIMEDOUT;
- else if (signal_pending(current))
- err = -EINTR;
+ if (ret <= 0) {
+ err = ret;
+ if (!err)
+ err = -ETIMEDOUT;
+ }
if (err)
goto err_out_exit;
@@ -505,13 +508,21 @@ struct dentry *pohmelfs_lookup(struct inode *dir, struct dentry *dentry, struct
struct pohmelfs_name *n;
struct inode *inode = NULL;
unsigned long ino = 0;
- int err, lock_type = POHMELFS_READ_LOCK, need_lock;
+ int err, lock_type = POHMELFS_READ_LOCK, need_lock = 1;
struct qstr str = dentry->d_name;
if ((nd->intent.open.flags & O_ACCMODE) > 1)
lock_type = POHMELFS_WRITE_LOCK;
- need_lock = pohmelfs_need_lock(parent, lock_type);
+ if (test_bit(NETFS_INODE_OWNED, &parent->state)) {
+ if (lock_type == parent->lock_type)
+ need_lock = 0;
+ if ((lock_type == POHMELFS_READ_LOCK) && (parent->lock_type == POHMELFS_WRITE_LOCK))
+ need_lock = 0;
+ }
+
+ if ((lock_type == POHMELFS_READ_LOCK) && !test_bit(NETFS_INODE_REMOTE_DIR_SYNCED, &parent->state))
+ need_lock = 1;
str.hash = jhash(dentry->d_name.name, dentry->d_name.len, 0);