/* The last ref on @file, maybe not the the owner pid of statahead.
* Different processes can open the same dir, "ll_opendir_key" means:
* it is me that should stop the statahead thread. */
- if (lli->lli_opendir_key == fd && lli->lli_opendir_pid != 0)
+ if (S_ISDIR(inode->i_mode) && lli->lli_opendir_key == fd &&
+ lli->lli_opendir_pid != 0)
ll_stop_statahead(inode, lli->lli_opendir_key);
if (inode->i_sb->s_root == file->f_dentry) {
RETURN(0);
}
- if (lsm)
- lov_test_and_clear_async_rc(lsm);
- lli->lli_async_rc = 0;
+ if (!S_ISDIR(inode->i_mode)) {
+ if (lsm)
+ lov_test_and_clear_async_rc(lsm);
+ lli->lli_async_rc = 0;
+ }
rc = ll_md_close(sbi->ll_md_exp, inode, file);
fd->fd_file = file;
if (S_ISDIR(inode->i_mode)) {
cfs_spin_lock(&lli->lli_sa_lock);
- if (lli->lli_opendir_key == NULL && lli->lli_opendir_pid == 0 &&
- lli->lli_sai == NULL) {
+ if (lli->lli_opendir_key == NULL && lli->lli_sai == NULL &&
+ lli->lli_opendir_pid == 0) {
lli->lli_opendir_key = fd;
lli->lli_opendir_pid = cfs_curproc_pid();
opendir_set = 1;
ll_stats_ops_tally(ll_i2sbi(inode), LPROC_LL_LLSEEK, 1);
if (origin == 2) { /* SEEK_END */
- int nonblock = 0, rc;
-
- if (file->f_flags & O_NONBLOCK)
- nonblock = LDLM_FL_BLOCK_NOWAIT;
+ int rc;
- rc = cl_glimpse_size(inode);
+ rc = ll_glimpse_size(inode);
if (rc != 0)
RETURN(rc);
struct lov_stripe_md *lsm = lli->lli_smd;
int rc, err;
+ LASSERT(!S_ISDIR(inode->i_mode));
+
/* the application should know write failure already. */
if (lli->lli_write_rc)
return 0;
return rc ? -EIO : 0;
}
+#ifndef HAVE_FILE_FSYNC_2ARGS
int ll_fsync(struct file *file, struct dentry *dentry, int data)
+#else
+int ll_fsync(struct file *file, int data)
+#endif
{
- struct inode *inode = dentry->d_inode;
+ struct inode *inode = file->f_dentry->d_inode;
struct ll_inode_info *lli = ll_i2info(inode);
struct lov_stripe_md *lsm = lli->lli_smd;
struct ptlrpc_request *req;
/* catch async errors that were recorded back when async writeback
* failed for pages in this mapping. */
- err = lli->lli_async_rc;
- lli->lli_async_rc = 0;
- if (rc == 0)
- rc = err;
- if (lsm) {
- err = lov_test_and_clear_async_rc(lsm);
+ if (!S_ISDIR(inode->i_mode)) {
+ err = lli->lli_async_rc;
+ lli->lli_async_rc = 0;
if (rc == 0)
rc = err;
+ if (lsm) {
+ err = lov_test_and_clear_async_rc(lsm);
+ if (rc == 0)
+ rc = err;
+ }
}
oc = ll_mdscapa_get(inode);
rc = err;
OBDO_FREE(oinfo->oi_oa);
OBD_FREE_PTR(oinfo);
- lli->lli_write_rc = err < 0 ? : 0;
+ lli->lli_write_rc = rc < 0 ? rc : 0;
}
RETURN(rc);
einfo.ei_mode = LCK_PW;
break;
default:
- CERROR("unknown fcntl lock type: %d\n", file_lock->fl_type);
- RETURN (-EINVAL);
+ CDEBUG(D_INFO, "Unknown fcntl lock type: %d\n",
+ file_lock->fl_type);
+ RETURN (-ENOTSUPP);
}
switch (cmd) {
{
struct inode *inode = dentry->d_inode;
struct ptlrpc_request *req = NULL;
- struct ll_sb_info *sbi;
struct obd_export *exp;
int rc = 0;
ENTRY;
CERROR("REPORT THIS LINE TO PETER\n");
RETURN(0);
}
- sbi = ll_i2sbi(inode);
CDEBUG(D_VFSTRACE, "VFS Op:inode=%lu/%u(%p),name=%s\n",
inode->i_ino, inode->i_generation, inode, dentry->d_name.name);
RETURN(0);
}
- /* cl_glimpse_size will prefer locally cached writes if they extend
+ /* ll_glimpse_size will prefer locally cached writes if they extend
* the file */
if (rc == 0)
- rc = cl_glimpse_size(inode);
+ rc = ll_glimpse_size(inode);
RETURN(rc);
}