Joseph Qi
2020-Feb-03 05:15 UTC
[Ocfs2-devel] [PATCH] ocfs2: fix the oops problem when write cloned file
On 20/2/3 10:17, Gang He wrote:> Hello Joseph, Changwei, Sunny and all, > > Could you help to review this patch? > This patch will fix the oops problem caused by write ocfs2 clone files. > The root cause is inode buffer head is NULL when calling ocfs2_refcount_cow. > Secondly, we should use EX meta lock when calling ocfs2_refcount_cow. >Before commit e74540b28556, we may also use NULL buffer head in case of overwrite, so why there is no such issue before? Thanks, Joseph
Gang He
2020-Feb-03 05:32 UTC
[Ocfs2-devel] [PATCH] ocfs2: fix the oops problem when write cloned file
Hi Joseph, before calling ocfs2_refcount_cow() in the function ocfs2_prepare_inode_for_write(), we do not use inode buffer_head. So, we can let buffer_head is NULL. But, when we invoke ocfs2_refcount_cow() function, we have to pass inode buffer_head without NULL pointer. That is why writing clone file will cause oops and kill the user-space process. Thanks Gang ________________________________________ From: Joseph Qi <joseph.qi at linux.alibaba.com> Sent: Monday, February 3, 2020 1:15 PM To: Gang He; mark at fasheh.com; jlbec at evilplan.org; gechangwei at live.cn; Shuning Zhang Cc: linux-kernel at vger.kernel.org; ocfs2-devel at oss.oracle.com; akpm at linux-foundation.org Subject: Re: [PATCH] ocfs2: fix the oops problem when write cloned file On 20/2/3 10:17, Gang He wrote:> Hello Joseph, Changwei, Sunny and all, > > Could you help to review this patch? > This patch will fix the oops problem caused by write ocfs2 clone files. > The root cause is inode buffer head is NULL when calling ocfs2_refcount_cow. > Secondly, we should use EX meta lock when calling ocfs2_refcount_cow. >Before commit e74540b28556, we may also use NULL buffer head in case of overwrite, so why there is no such issue before? Thanks, Joseph