Message ID | 20220803155315.2073584-1-yifeliu@cs.stonybrook.edu |
---|---|
State | New |
Delegated to: | Richard Weinberger |
Headers | show |
Series | jffs2: correct logic when creating a hole in jffs2_write_begin | expand |
What happened with this patch? Looks like a important fix but I don't see it applied ? Jocke
----- Ursprüngliche Mail ----- > Von: "Joakim Tjernlund" <Joakim.Tjernlund@infinera.com> > An: "Yifei Liu" <yifeliu@cs.stonybrook.edu> > CC: ezk@cs.stonybrook.edu, madkar@cs.stonybrook.edu, "David Woodhouse" <dwmw2@infradead.org>, "richard" > <richard@nod.at>, "Matthew Wilcox" <willy@infradead.org>, "Kyeong Yoo" <kyeong.yoo@alliedtelesis.co.nz>, "linux-mtd" > <linux-mtd@lists.infradead.org>, "linux-kernel" <linux-kernel@vger.kernel.org> > Gesendet: Sonntag, 21. August 2022 20:21:04 > Betreff: Re: [PATCH] jffs2: correct logic when creating a hole in jffs2_write_begin > What happened with this patch? Looks like a important fix but I don't see it > applied ? It will be part of the next fixes PR after I had a chance to review it. Thanks, //richard
A gentle reminder. Best Regards, Yifei Best Regards, Yifei On Mon, Aug 22, 2022 at 2:26 AM Richard Weinberger <richard@nod.at> wrote: > > ----- Ursprüngliche Mail ----- > > Von: "Joakim Tjernlund" <Joakim.Tjernlund@infinera.com> > > An: "Yifei Liu" <yifeliu@cs.stonybrook.edu> > > CC: ezk@cs.stonybrook.edu, madkar@cs.stonybrook.edu, "David Woodhouse" <dwmw2@infradead.org>, "richard" > > <richard@nod.at>, "Matthew Wilcox" <willy@infradead.org>, "Kyeong Yoo" <kyeong.yoo@alliedtelesis.co.nz>, "linux-mtd" > > <linux-mtd@lists.infradead.org>, "linux-kernel" <linux-kernel@vger.kernel.org> > > Gesendet: Sonntag, 21. August 2022 20:21:04 > > Betreff: Re: [PATCH] jffs2: correct logic when creating a hole in jffs2_write_begin > > > What happened with this patch? Looks like a important fix but I don't see it > > applied ? > > It will be part of the next fixes PR after I had a chance to review it. > > Thanks, > //richard
A reminder about a JFFS2 patch submitted months ago. Best Regards, Yifei On Sun, Sep 4, 2022 at 3:39 PM Yifei Liu <yifeliu@cs.stonybrook.edu> wrote: > > A gentle reminder. > > Best Regards, > Yifei > > Best Regards, > Yifei > > > On Mon, Aug 22, 2022 at 2:26 AM Richard Weinberger <richard@nod.at> wrote: > > > > ----- Ursprüngliche Mail ----- > > > Von: "Joakim Tjernlund" <Joakim.Tjernlund@infinera.com> > > > An: "Yifei Liu" <yifeliu@cs.stonybrook.edu> > > > CC: ezk@cs.stonybrook.edu, madkar@cs.stonybrook.edu, "David Woodhouse" <dwmw2@infradead.org>, "richard" > > > <richard@nod.at>, "Matthew Wilcox" <willy@infradead.org>, "Kyeong Yoo" <kyeong.yoo@alliedtelesis.co.nz>, "linux-mtd" > > > <linux-mtd@lists.infradead.org>, "linux-kernel" <linux-kernel@vger.kernel.org> > > > Gesendet: Sonntag, 21. August 2022 20:21:04 > > > Betreff: Re: [PATCH] jffs2: correct logic when creating a hole in jffs2_write_begin > > > > > What happened with this patch? Looks like a important fix but I don't see it > > > applied ? > > > > It will be part of the next fixes PR after I had a chance to review it. > > > > Thanks, > > //richard
diff --git a/fs/jffs2/file.c b/fs/jffs2/file.c index ba86acbe12d3..0479096b96e4 100644 --- a/fs/jffs2/file.c +++ b/fs/jffs2/file.c @@ -137,19 +137,18 @@ static int jffs2_write_begin(struct file *filp, struct address_space *mapping, struct jffs2_inode_info *f = JFFS2_INODE_INFO(inode); struct jffs2_sb_info *c = JFFS2_SB_INFO(inode->i_sb); pgoff_t index = pos >> PAGE_SHIFT; - uint32_t pageofs = index << PAGE_SHIFT; int ret = 0; jffs2_dbg(1, "%s()\n", __func__); - if (pageofs > inode->i_size) { - /* Make new hole frag from old EOF to new page */ + if (pos > inode->i_size) { + /* Make new hole frag from old EOF to new position */ struct jffs2_raw_inode ri; struct jffs2_full_dnode *fn; uint32_t alloc_len; - jffs2_dbg(1, "Writing new hole frag 0x%x-0x%x between current EOF and new page\n", - (unsigned int)inode->i_size, pageofs); + jffs2_dbg(1, "Writing new hole frag 0x%x-0x%x between current EOF and new position\n", + (unsigned int)inode->i_size, (uint32_t)pos); ret = jffs2_reserve_space(c, sizeof(ri), &alloc_len, ALLOC_NORMAL, JFFS2_SUMMARY_INODE_SIZE); @@ -169,10 +168,10 @@ static int jffs2_write_begin(struct file *filp, struct address_space *mapping, ri.mode = cpu_to_jemode(inode->i_mode); ri.uid = cpu_to_je16(i_uid_read(inode)); ri.gid = cpu_to_je16(i_gid_read(inode)); - ri.isize = cpu_to_je32(max((uint32_t)inode->i_size, pageofs)); + ri.isize = cpu_to_je32((uint32_t)pos); ri.atime = ri.ctime = ri.mtime = cpu_to_je32(JFFS2_NOW()); ri.offset = cpu_to_je32(inode->i_size); - ri.dsize = cpu_to_je32(pageofs - inode->i_size); + ri.dsize = cpu_to_je32((uint32_t)pos - inode->i_size); ri.csize = cpu_to_je32(0); ri.compr = JFFS2_COMPR_ZERO; ri.node_crc = cpu_to_je32(crc32(0, &ri, sizeof(ri)-8)); @@ -202,7 +201,7 @@ static int jffs2_write_begin(struct file *filp, struct address_space *mapping, goto out_err; } jffs2_complete_reservation(c); - inode->i_size = pageofs; + inode->i_size = pos; mutex_unlock(&f->sem); }