@@ -447,8 +447,26 @@ void ll_dom_finish_open(struct inode *inode, struct ptlrpc_request *req,
if (!rnb || rnb->rnb_len == 0)
return;
- CDEBUG(D_INFO, "Get data buffer along with open, len %i, i_size %llu\n",
- rnb->rnb_len, i_size_read(inode));
+ /* LU-11595: Server may return whole file and that is OK always or
+ * it may return just file tail and its offset must be aligned with
+ * client PAGE_SIZE to be used on that client, if server's PAGE_SIZE is
+ * smaller then offset may be not aligned and that data is just ignored.
+ */
+ if (rnb->rnb_offset % PAGE_SIZE)
+ return;
+
+ /* Server returns whole file or just file tail if it fills in
+ * reply buffer, in both cases total size should be inode size.
+ */
+ if (rnb->rnb_offset + rnb->rnb_len < i_size_read(inode)) {
+ CERROR("%s: server returns off/len %llu/%u < i_size %llu\n",
+ ll_get_fsname(inode->i_sb, NULL, 0), rnb->rnb_offset,
+ rnb->rnb_len, i_size_read(inode));
+ return;
+ }
+
+ CDEBUG(D_INFO, "Get data along with open at %llu len %i, i_size %llu\n",
+ rnb->rnb_offset, rnb->rnb_len, i_size_read(inode));
data = (char *)rnb + sizeof(*rnb);
@@ -162,7 +162,8 @@ int mdc_ldlm_blocking_ast(struct ldlm_lock *dlmlock,
int mdc_ldlm_glimpse_ast(struct ldlm_lock *dlmlock, void *data);
int mdc_fill_lvb(struct ptlrpc_request *req, struct ost_lvb *lvb);
-#define MDC_DOM_DEF_INLINE_REPSIZE 8192
+/* the minimum inline repsize should be PAGE_SIZE at least */
+#define MDC_DOM_DEF_INLINE_REPSIZE max(8192UL, PAGE_SIZE)
#define MDC_DOM_MAX_INLINE_REPSIZE XATTR_SIZE_MAX
#endif