if(cfs_down_interruptible(&lli->lli_write_sem))
GOTO(out, result = -ERESTARTSYS);
write_sem_locked = 1;
+ } else if (iot == CIT_READ) {
+ cfs_down_read(&lli->lli_trunc_sem);
}
break;
case IO_SENDFILE:
result = cl_io_loop(env, io);
if (write_sem_locked)
cfs_up(&lli->lli_write_sem);
+ else if (args->via_io_subtype == IO_NORMAL && iot == CIT_READ)
+ cfs_up_read(&lli->lli_trunc_sem);
} else {
/* cl_io_rw_init() handled IO */
result = io->ci_result;
exp = ll_i2mdexp(inode);
+ /* XXX: Enable OBD_CONNECT_ATTRFID to reduce unnecessary getattr RPC.
+ * But under CMD case, it caused some lock issues, should be fixed
+ * with new CMD ibits lock. See bug 12718 */
if (exp->exp_connect_flags & OBD_CONNECT_ATTRFID) {
struct lookup_intent oit = { .it_op = IT_GETATTR };
struct md_op_data *op_data;
return -EROFS;
if ((mask & MAY_WRITE) && IS_IMMUTABLE(inode))
return -EACCES;
- if (current->fsuid == inode->i_uid) {
+ if (cfs_curproc_fsuid() == inode->i_uid) {
mode >>= 6;
} else if (1) {
if (((mode >> 3) & mask & S_IRWXO) != mask)