diff options
Diffstat (limited to 'drivers/staging/pohmelfs/dir.c')
-rw-r--r-- | drivers/staging/pohmelfs/dir.c | 25 |
1 files changed, 18 insertions, 7 deletions
diff --git a/drivers/staging/pohmelfs/dir.c b/drivers/staging/pohmelfs/dir.c index 4c63a4cc1bd..6c5b261e9f0 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; } @@ -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); |