diff options
-rw-r--r-- | fs/ocfs2/aops.c | 12 | ||||
-rw-r--r-- | fs/ocfs2/cluster/masklog.h | 9 |
2 files changed, 19 insertions, 2 deletions
diff --git a/fs/ocfs2/aops.c b/fs/ocfs2/aops.c index da578ad4c08f..eb1ce30412dc 100644 --- a/fs/ocfs2/aops.c +++ b/fs/ocfs2/aops.c | |||
@@ -2411,8 +2411,16 @@ static int ocfs2_dio_end_io(struct kiocb *iocb, | |||
2411 | /* this io's submitter should not have unlocked this before we could */ | 2411 | /* this io's submitter should not have unlocked this before we could */ |
2412 | BUG_ON(!ocfs2_iocb_is_rw_locked(iocb)); | 2412 | BUG_ON(!ocfs2_iocb_is_rw_locked(iocb)); |
2413 | 2413 | ||
2414 | if (bytes > 0 && private) | 2414 | if (bytes <= 0) |
2415 | ret = ocfs2_dio_end_io_write(inode, private, offset, bytes); | 2415 | mlog_ratelimited(ML_ERROR, "Direct IO failed, bytes = %lld", |
2416 | (long long)bytes); | ||
2417 | if (private) { | ||
2418 | if (bytes > 0) | ||
2419 | ret = ocfs2_dio_end_io_write(inode, private, offset, | ||
2420 | bytes); | ||
2421 | else | ||
2422 | ocfs2_dio_free_write_ctx(inode, private); | ||
2423 | } | ||
2416 | 2424 | ||
2417 | ocfs2_iocb_clear_rw_locked(iocb); | 2425 | ocfs2_iocb_clear_rw_locked(iocb); |
2418 | 2426 | ||
diff --git a/fs/ocfs2/cluster/masklog.h b/fs/ocfs2/cluster/masklog.h index 308ea0eb35fd..a396096a5099 100644 --- a/fs/ocfs2/cluster/masklog.h +++ b/fs/ocfs2/cluster/masklog.h | |||
@@ -178,6 +178,15 @@ do { \ | |||
178 | ##__VA_ARGS__); \ | 178 | ##__VA_ARGS__); \ |
179 | } while (0) | 179 | } while (0) |
180 | 180 | ||
181 | #define mlog_ratelimited(mask, fmt, ...) \ | ||
182 | do { \ | ||
183 | static DEFINE_RATELIMIT_STATE(_rs, \ | ||
184 | DEFAULT_RATELIMIT_INTERVAL, \ | ||
185 | DEFAULT_RATELIMIT_BURST); \ | ||
186 | if (__ratelimit(&_rs)) \ | ||
187 | mlog(mask, fmt, ##__VA_ARGS__); \ | ||
188 | } while (0) | ||
189 | |||
181 | #define mlog_errno(st) ({ \ | 190 | #define mlog_errno(st) ({ \ |
182 | int _st = (st); \ | 191 | int _st = (st); \ |
183 | if (_st != -ERESTARTSYS && _st != -EINTR && \ | 192 | if (_st != -ERESTARTSYS && _st != -EINTR && \ |