diff options
author | Russell King <rmk+kernel@arm.linux.org.uk> | 2009-09-22 19:54:53 (GMT) |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2009-09-22 20:01:40 (GMT) |
commit | ae19ffbadc1b2100285a5b5b3d0a4e0a11390904 (patch) | |
tree | 3c2086ab67398a019089a47ca3f362a4bc6db74f /drivers/staging/pohmelfs/dir.c | |
parent | 34e84f39a27d059a3e6ec6e8b94aafa702e6f220 (diff) | |
parent | 9173a8ef24a6b1b8031507b35b8ffe5f85a87692 (diff) | |
download | linux-fsl-qoriq-ae19ffbadc1b2100285a5b5b3d0a4e0a11390904.tar.xz |
Merge branch 'master' into for-linus
Diffstat (limited to 'drivers/staging/pohmelfs/dir.c')
-rw-r--r-- | drivers/staging/pohmelfs/dir.c | 27 |
1 files changed, 19 insertions, 8 deletions
diff --git a/drivers/staging/pohmelfs/dir.c b/drivers/staging/pohmelfs/dir.c index 4c58e22..6c5b261 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); |