GOTO(out, result);
out:
cl_io_fini(env, io);
- if (iot == CIT_WRITE)
- lli->lli_write_rc = result < 0 ? : 0;
+
+ if (iot == CIT_READ) {
+ if (result >= 0)
+ ll_stats_ops_tally(ll_i2sbi(file->f_dentry->d_inode),
+ LPROC_LL_READ_BYTES, result);
+ } else if (iot == CIT_WRITE) {
+ if (result >= 0) {
+ ll_stats_ops_tally(ll_i2sbi(file->f_dentry->d_inode),
+ LPROC_LL_WRITE_BYTES, result);
+ lli->lli_write_rc = 0;
+ } else {
+ lli->lli_write_rc = result;
+ }
+ }
+
return result;
}
}
flock.l_flock.pid = file_lock->fl_pid;
+ /* Somewhat ugly workaround for svc lockd.
+ * lockd installs custom fl_lmops->fl_compare_owner that checks
+ * for the fl_owner to be the same (which it always is on local node
+ * I guess between lockd processes) and then compares pid.
+ * As such we assign pid to the owner field to make it all work,
+ * conflict with normal locks is unlikely since pid space and
+ * pointer space for current->files are not intersecting */
+ if (file_lock->fl_lmops && file_lock->fl_lmops->fl_compare_owner)
+ flock.l_flock.owner = (unsigned long)file_lock->fl_pid;
+
switch (file_lock->fl_type) {
case F_RDLCK:
einfo.ei_mode = LCK_PR;