From: "Matthew Wilcox (Oracle)" <willy@infradead.org> To: linux-fsdevel@vger.kernel.org Cc: "Matthew Wilcox (Oracle)" <willy@infradead.org>, ericvh@gmail.com, lucho@ionkov.net, viro@zeniv.linux.org.uk, jlayton@kernel.org, idryomov@gmail.com, mark@fasheh.com, jlbec@evilplan.org, joseph.qi@linux.alibaba.com, v9fs-developer@lists.sourceforge.net, linux-kernel@vger.kernel.org, ceph-devel@vger.kernel.org, ocfs2-devel@oss.oracle.com, linux-btrfs@vger.kernel.org, clm@fb.com, josef@toxicpanda.com, dsterba@suse.com, stable@vger.kernel.org Subject: [PATCH 5/7] btrfs: Promote to unsigned long long before shifting Date: Sun, 4 Oct 2020 19:04:26 +0100 Message-ID: <20201004180428.14494-6-willy@infradead.org> (raw) In-Reply-To: <20201004180428.14494-1-willy@infradead.org> On 32-bit systems, this shift will overflow for files larger than 4GB. Cc: stable@vger.kernel.org Fixes: df480633b891 ("btrfs: extent-tree: Switch to new delalloc space reserve and release") Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org> --- fs/btrfs/ioctl.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c index ac45f022b495..4d3b7e4ae53a 100644 --- a/fs/btrfs/ioctl.c +++ b/fs/btrfs/ioctl.c @@ -1277,7 +1277,7 @@ static int cluster_pages_for_defrag(struct inode *inode, page_cnt = min_t(u64, (u64)num_pages, (u64)file_end - start_index + 1); ret = btrfs_delalloc_reserve_space(BTRFS_I(inode), &data_reserved, - start_index << PAGE_SHIFT, + (loff_t)start_index << PAGE_SHIFT, page_cnt << PAGE_SHIFT); if (ret) return ret; @@ -1367,7 +1367,7 @@ static int cluster_pages_for_defrag(struct inode *inode, btrfs_mod_outstanding_extents(BTRFS_I(inode), 1); spin_unlock(&BTRFS_I(inode)->lock); btrfs_delalloc_release_space(BTRFS_I(inode), data_reserved, - start_index << PAGE_SHIFT, + (loff_t)start_index << PAGE_SHIFT, (page_cnt - i_done) << PAGE_SHIFT, true); } @@ -1395,7 +1395,7 @@ static int cluster_pages_for_defrag(struct inode *inode, put_page(pages[i]); } btrfs_delalloc_release_space(BTRFS_I(inode), data_reserved, - start_index << PAGE_SHIFT, + (loff_t)start_index << PAGE_SHIFT, page_cnt << PAGE_SHIFT, true); btrfs_delalloc_release_extents(BTRFS_I(inode), page_cnt << PAGE_SHIFT); extent_changeset_free(data_reserved); -- 2.28.0
next prev parent reply index Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-10-04 18:04 [PATCH 0/7] Fix a pile of 4GB file problems on 32-bit Matthew Wilcox (Oracle) 2020-10-04 18:04 ` [PATCH 1/7] 9P: Cast to loff_t before multiplying Matthew Wilcox (Oracle) 2020-10-07 5:48 ` Christoph Hellwig 2020-10-07 18:47 ` Matthew Wilcox 2020-10-26 17:14 ` Dominique Martinet 2020-10-04 18:04 ` [PATCH 2/7] buffer: Promote to unsigned long long before shifting Matthew Wilcox (Oracle) 2020-10-04 18:04 ` [PATCH 3/7] ceph: " Matthew Wilcox (Oracle) 2020-10-06 11:29 ` Jeff Layton 2020-10-06 17:20 ` Jeff Layton 2020-10-04 18:04 ` [PATCH 4/7] ocfs2: " Matthew Wilcox (Oracle) 2020-10-04 18:04 ` Matthew Wilcox (Oracle) [this message] 2020-10-09 14:18 ` [PATCH 5/7] btrfs: " Josef Bacik 2020-10-26 17:02 ` David Sterba 2020-10-04 18:04 ` [PATCH 6/7] " Matthew Wilcox (Oracle) 2020-10-09 14:18 ` Josef Bacik 2020-10-26 16:35 ` David Sterba 2020-10-26 16:44 ` Matthew Wilcox 2020-10-26 17:03 ` David Sterba 2020-10-04 18:04 ` [PATCH 7/7] btrfs: Promote to unsigned long long before multiplying Matthew Wilcox (Oracle) 2020-10-26 16:21 ` David Sterba
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20201004180428.14494-6-willy@infradead.org \ --to=willy@infradead.org \ --cc=ceph-devel@vger.kernel.org \ --cc=clm@fb.com \ --cc=dsterba@suse.com \ --cc=ericvh@gmail.com \ --cc=idryomov@gmail.com \ --cc=jlayton@kernel.org \ --cc=jlbec@evilplan.org \ --cc=josef@toxicpanda.com \ --cc=joseph.qi@linux.alibaba.com \ --cc=linux-btrfs@vger.kernel.org \ --cc=linux-fsdevel@vger.kernel.org \ --cc=linux-kernel@vger.kernel.org \ --cc=lucho@ionkov.net \ --cc=mark@fasheh.com \ --cc=ocfs2-devel@oss.oracle.com \ --cc=stable@vger.kernel.org \ --cc=v9fs-developer@lists.sourceforge.net \ --cc=viro@zeniv.linux.org.uk \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
Linux-Fsdevel Archive on lore.kernel.org Archives are clonable: git clone --mirror https://lore.kernel.org/linux-fsdevel/0 linux-fsdevel/git/0.git # If you have public-inbox 1.1+ installed, you may # initialize and index your mirror using the following commands: public-inbox-init -V2 linux-fsdevel linux-fsdevel/ https://lore.kernel.org/linux-fsdevel \ linux-fsdevel@vger.kernel.org public-inbox-index linux-fsdevel Example config snippet for mirrors Newsgroup available over NNTP: nntp://nntp.lore.kernel.org/org.kernel.vger.linux-fsdevel AGPL code for this site: git clone https://public-inbox.org/public-inbox.git