On Sun, 16 Aug 2009, npiggin@xxxxxxx wrote: > mm/shmem.c | 35 +++++++++++++++++++---------------- > 1 file changed, 19 insertions(+), 16 deletions(-) That looks fine to me, thanks Nick, with one reservation: there is no case (at present anyway) in which simple_setsize() can fail with non-NULL page to release; but that does depend upon some inside knowledge, so it'll look less worrying if we move up the page_cache_release. Please fold the below patch in to add my Acked-by: Hugh Dickins <hugh.dickins@xxxxxxxxxxxxx> --- 2.6.31-rc6-trunc/mm/shmem.c 2009-08-16 17:09:57.000000000 +0100 +++ linux/mm/shmem.c 2009-08-16 19:11:51.000000000 +0100 @@ -767,13 +767,13 @@ done2: static int shmem_notify_change(struct dentry *dentry, struct iattr *attr) { struct inode *inode = dentry->d_inode; - struct page *page = NULL; int error; if (S_ISREG(inode->i_mode) && (attr->ia_valid & ATTR_SIZE)) { loff_t newsize = attr->ia_size; + struct page *page = NULL; - if (attr->ia_size < inode->i_size) { + if (newsize < inode->i_size) { /* * If truncating down to a partial page, then * if that page is already allocated, hold it @@ -804,6 +804,8 @@ static int shmem_notify_change(struct de } error = simple_setsize(inode, newsize); + if (page) + page_cache_release(page); if (error) return error; shmem_truncate_range(inode, newsize, (loff_t)-1); @@ -817,8 +819,6 @@ static int shmem_notify_change(struct de if (!error && (attr->ia_valid & ATTR_MODE)) error = generic_acl_chmod(inode, &shmem_acl_ops); #endif - if (page) - page_cache_release(page); return error; } -- To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html