Commit c1e72549 authored by Taotao Chen's avatar Taotao Chen Committed by Tvrtko Ursulin
Browse files

drm/i915: set O_LARGEFILE in __create_shmem()



Without O_LARGEFILE, file->f_op->write_iter calls
generic_write_check_limits(), which enforces a 2GB (MAX_NON_LFS) limit,
causing -EFBIG on large writes.

In shmem_pwrite(), this error is later masked as -EIO due to the error
handling order, leading to igt failures like gen9_exec_parse(bb-large).

Set O_LARGEFILE in __create_shmem() to prevent -EFBIG on large writes.

Reported-by: default avatarkernel test robot <oliver.sang@intel.com>
Closes: https://lore.kernel.org/oe-lkp/202508081029.343192ec-lkp@intel.com


Fixes: 048832a3 ("drm/i915: Refactor shmem_pwrite() to use kiocb and write_iter")
Signed-off-by: default avatarTaotao Chen <chentaotao@didiglobal.com>
Reviewed-by: default avatarAndi Shyti <andi.shyti@linux.intel.com>
Signed-off-by: default avatarAndi Shyti <andi.shyti@linux.intel.com>
Link: https://lore.kernel.org/r/20250822030651.28099-1-chentaotao@didiglobal.com


(cherry picked from commit e296a226)
Signed-off-by: default avatarTvrtko Ursulin <tursulin@ursulin.net>
parent 07e27ad1
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -514,6 +514,13 @@ static int __create_shmem(struct drm_i915_private *i915,
	if (IS_ERR(filp))
		return PTR_ERR(filp);

	/*
	 * Prevent -EFBIG by allowing large writes beyond MAX_NON_LFS on shmem
	 * objects by setting O_LARGEFILE.
	 */
	if (force_o_largefile())
		filp->f_flags |= O_LARGEFILE;

	obj->filp = filp;
	return 0;
}