Re: [Ocfs2-devel] [PATCH] ocfs2: Fix start offset to ocfs2_zero_range_for_truncate()

2016-09-14 Thread Ashish Samant
On 09/14/2016 03:43 PM, Andrew Morton wrote: > On Thu, 11 Aug 2016 16:12:27 -0700 Ashish Samant > wrote: > >> If we do fallocate with punch hole option on a reflink, with start offset >> on a cluster boundary and end offset somewhere in another cluster, we >> dont COW

Re: [Ocfs2-devel] [PATCH] ocfs2: Fix start offset to ocfs2_zero_range_for_truncate()

2016-09-14 Thread Andrew Morton
On Thu, 11 Aug 2016 16:12:27 -0700 Ashish Samant wrote: > If we do fallocate with punch hole option on a reflink, with start offset > on a cluster boundary and end offset somewhere in another cluster, we > dont COW the first cluster starting at the start offset. But in

[Ocfs2-devel] [PATCH v2 RESEND] ocfs2: fix double unlock in case retry after free truncate log

2016-09-14 Thread Joseph Qi
If ocfs2_reserve_cluster_bitmap_bits fails with ENOSPC, it will try to free truncate log and then retry. Since ocfs2_try_to_free_truncate_log will lock/unlock global bitmap inode, we have to unlock it before calling this function. But when retry reserve and it fails with no global bitmap inode

Re: [Ocfs2-devel] [PATCH] ocfs2: fix deadlock on mmapped page in ocfs2_write_begin_nolock()

2016-09-14 Thread Joseph Qi
Okay, IC. So we have to take care of all errors for ocfs2_write_begin_nolock. On 2016/9/14 16:43, Eric Ren wrote: > Hi Joseph, > > On 09/14/2016 04:25 PM, Joseph Qi wrote: >> Hi Eric, >> Sorry for the delayed response. >> I have got your explanation. So we have to unlock the page only in case >>

[Ocfs2-devel] [PATCH v2] ocfs2: fix double unlock in case retry after free truncate log

2016-09-14 Thread Joseph Qi
If ocfs2_reserve_cluster_bitmap_bits fails with ENOSPC, it will try to free truncate log and then retry. Since ocfs2_try_to_free_truncate_log will lock/unlock global bitmap inode, we have to unlock it before calling this function. But when retry reserve and it fails with no global bitmap inode

Re: [Ocfs2-devel] [PATCH] ocfs2: fix deadlock on mmapped page in ocfs2_write_begin_nolock()

2016-09-14 Thread Eric Ren
Hi Joseph, On 09/14/2016 04:25 PM, Joseph Qi wrote: > Hi Eric, > Sorry for the delayed response. > I have got your explanation. So we have to unlock the page only in case > of retry, right? > If so, I think the unlock should be right before "goto try_again". No, the mmapped page should be

Re: [Ocfs2-devel] [PATCH] ocfs2: fix deadlock on mmapped page in ocfs2_write_begin_nolock()

2016-09-14 Thread Joseph Qi
Hi Eric, Sorry for the delayed response. I have got your explanation. So we have to unlock the page only in case of retry, right? If so, I think the unlock should be right before "goto try_again". Thanks, Joseph On 2016/9/14 16:04, Eric Ren wrote: > Hi Joseph, In ocfs2_write_begin_nolock(),

Re: [Ocfs2-devel] [PATCH] ocfs2: fix double unlock in case retry after free truncate log

2016-09-14 Thread Joseph Qi
Hi Eric, On 2016/9/14 15:57, Eric Ren wrote: > Hello Joseph, > > Thanks for fixing up this. > > On 09/14/2016 12:15 PM, Joseph Qi wrote: >> If ocfs2_reserve_cluster_bitmap_bits fails with ENOSPC, it will try to >> free truncate log and then retry. Since ocfs2_try_to_free_truncate_log >> will

Re: [Ocfs2-devel] [PATCH] ocfs2: fix deadlock on mmapped page in ocfs2_write_begin_nolock()

2016-09-14 Thread Eric Ren
Hi, On 09/12/2016 11:06 AM, Eric Ren wrote: > Hi, >>> IMO, in ocfs2_grab_pages_for_write, mmap_page is mapping to w_pages and >>> w_target_locked is set to true, and then will be unlocked by >>> ocfs2_unlock_pages in ocfs2_free_write_ctxt. >>> So I'm not getting the case "page isn't unlock".

Re: [Ocfs2-devel] [PATCH] ocfs2: fix deadlock on mmapped page in ocfs2_write_begin_nolock()

2016-09-14 Thread Eric Ren
Hi Joseph, In ocfs2_write_begin_nolock(), we first grab the pages and then allocate disk space for this write; ocfs2_try_to_free_truncate_log() will be called if ENOSPC is turned; if we're lucky to get enough clusters, which is usually the case, we start over again. But in