From patchwork Sun Oct 4 18:04:22 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 11815777 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C555617F0 for ; Sun, 4 Oct 2020 18:06:02 +0000 (UTC) Received: from aserp2130.oracle.com (aserp2130.oracle.com [141.146.126.79]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 88A1C2078A for ; Sun, 4 Oct 2020 18:06:02 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 88A1C2078A Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=ocfs2-devel-bounces@oss.oracle.com Received: from pps.filterd (aserp2130.oracle.com [127.0.0.1]) by aserp2130.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 094I4ukS149544; Sun, 4 Oct 2020 18:05:52 GMT Received: from userp3020.oracle.com (userp3020.oracle.com [156.151.31.79]) by aserp2130.oracle.com with ESMTP id 33xetak0q7-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Sun, 04 Oct 2020 18:05:52 +0000 Received: from pps.filterd (userp3020.oracle.com [127.0.0.1]) by userp3020.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 094I4x1Z158726; Sun, 4 Oct 2020 18:05:52 GMT Received: from oss.oracle.com (oss-old-reserved.oracle.com [137.254.22.2]) by userp3020.oracle.com with ESMTP id 33y32nwr6t-1 (version=TLSv1 cipher=AES256-SHA bits=256 verify=NO); Sun, 04 Oct 2020 18:05:51 +0000 Received: from localhost ([127.0.0.1] helo=lb-oss.oracle.com) by oss.oracle.com with esmtp (Exim 4.63) (envelope-from ) id 1kP8OM-0000Ys-Vy; Sun, 04 Oct 2020 11:05:50 -0700 Received: from aserp3030.oracle.com ([141.146.126.71]) by oss.oracle.com with esmtp (Exim 4.63) (envelope-from ) id 1kP8Nf-0000Ur-7S for ocfs2-devel@oss.oracle.com; Sun, 04 Oct 2020 11:05:07 -0700 Received: from pps.filterd (aserp3030.oracle.com [127.0.0.1]) by aserp3030.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 094I57pt030015 for ; Sun, 4 Oct 2020 18:05:07 GMT Received: from userp2030.oracle.com (userp2030.oracle.com [156.151.31.89]) by aserp3030.oracle.com with ESMTP id 33y2vjra3w-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Sun, 04 Oct 2020 18:04:56 +0000 Received: from pps.filterd (userp2030.oracle.com [127.0.0.1]) by userp2030.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 094I44Z0016530 for ; Sun, 4 Oct 2020 18:04:56 GMT Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by userp2030.oracle.com with ESMTP id 33xfbg7byx-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO) for ; Sun, 04 Oct 2020 18:04:55 +0000 Received: from willy by casper.infradead.org with local (Exim 4.92.3 #3 (Red Hat Linux)) id 1kP8N5-0003mY-6K; Sun, 04 Oct 2020 18:04:31 +0000 From: "Matthew Wilcox (Oracle)" To: linux-fsdevel@vger.kernel.org Date: Sun, 4 Oct 2020 19:04:22 +0100 Message-Id: <20201004180428.14494-2-willy@infradead.org> X-Mailer: git-send-email 2.21.3 In-Reply-To: <20201004180428.14494-1-willy@infradead.org> References: <20201004180428.14494-1-willy@infradead.org> MIME-Version: 1.0 X-PDR: PASS X-Source-IP: 90.155.50.34 X-ServerName: casper.infradead.org X-Proofpoint-SPF-Result: None X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9764 signatures=668680 X-Proofpoint-Spam-Details: rule=tap_notspam policy=tap score=0 spamscore=0 mlxscore=0 clxscore=322 impostorscore=0 lowpriorityscore=0 priorityscore=162 adultscore=0 bulkscore=0 malwarescore=0 suspectscore=1 phishscore=0 mlxlogscore=331 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2006250000 definitions=main-2010040140 X-Spam: Clean Cc: lucho@ionkov.net, stable@vger.kernel.org, clm@fb.com, ericvh@gmail.com, linux-btrfs@vger.kernel.org, jlayton@kernel.org, linux-kernel@vger.kernel.org, josef@toxicpanda.com, viro@zeniv.linux.org.uk, dsterba@suse.com, v9fs-developer@lists.sourceforge.net, idryomov@gmail.com, ceph-devel@vger.kernel.org, ocfs2-devel@oss.oracle.com Subject: [Ocfs2-devel] [PATCH 1/7] 9P: Cast to loff_t before multiplying X-BeenThere: ocfs2-devel@oss.oracle.com X-Mailman-Version: 2.1.9 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: ocfs2-devel-bounces@oss.oracle.com Errors-To: ocfs2-devel-bounces@oss.oracle.com X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9764 signatures=668680 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0 phishscore=0 mlxlogscore=999 mlxscore=0 bulkscore=0 adultscore=0 spamscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2006250000 definitions=main-2010040140 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9764 signatures=668680 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 spamscore=0 mlxscore=0 clxscore=1034 priorityscore=1501 adultscore=0 mlxlogscore=999 phishscore=0 impostorscore=0 malwarescore=0 suspectscore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2006250000 definitions=main-2010040140 On 32-bit systems, this multiplication will overflow for files larger than 4GB. Cc: stable@vger.kernel.org Fixes: fb89b45cdfdc ("9P: introduction of a new cache=mmap model.") Signed-off-by: Matthew Wilcox (Oracle) --- fs/9p/vfs_file.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fs/9p/vfs_file.c b/fs/9p/vfs_file.c index 3576123d8299..6d97b6b4d34b 100644 --- a/fs/9p/vfs_file.c +++ b/fs/9p/vfs_file.c @@ -612,9 +612,9 @@ static void v9fs_mmap_vm_close(struct vm_area_struct *vma) struct writeback_control wbc = { .nr_to_write = LONG_MAX, .sync_mode = WB_SYNC_ALL, - .range_start = vma->vm_pgoff * PAGE_SIZE, + .range_start = (loff_t)vma->vm_pgoff * PAGE_SIZE, /* absolute end, byte at end included */ - .range_end = vma->vm_pgoff * PAGE_SIZE + + .range_end = (loff_t)vma->vm_pgoff * PAGE_SIZE + (vma->vm_end - vma->vm_start - 1), }; From patchwork Sun Oct 4 18:04:23 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 11815787 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 4B238112E for ; Sun, 4 Oct 2020 18:06:10 +0000 (UTC) Received: from aserp2120.oracle.com (aserp2120.oracle.com [141.146.126.78]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 1904B206B6 for ; Sun, 4 Oct 2020 18:06:09 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1904B206B6 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=ocfs2-devel-bounces@oss.oracle.com Received: from pps.filterd (aserp2120.oracle.com [127.0.0.1]) by aserp2120.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 094I63U2082387; Sun, 4 Oct 2020 18:06:03 GMT Received: from userp3030.oracle.com (userp3030.oracle.com [156.151.31.80]) by aserp2120.oracle.com with ESMTP id 33xh8kjtxn-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Sun, 04 Oct 2020 18:06:03 +0000 Received: from pps.filterd (userp3030.oracle.com [127.0.0.1]) by userp3030.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 094I61ut086152; Sun, 4 Oct 2020 18:06:02 GMT Received: from oss.oracle.com (oss-old-reserved.oracle.com [137.254.22.2]) by userp3030.oracle.com with ESMTP id 33y37u7w0g-1 (version=TLSv1 cipher=AES256-SHA bits=256 verify=NO); Sun, 04 Oct 2020 18:06:02 +0000 Received: from localhost ([127.0.0.1] helo=lb-oss.oracle.com) by oss.oracle.com with esmtp (Exim 4.63) (envelope-from ) id 1kP8OQ-0000aX-6h; Sun, 04 Oct 2020 11:05:54 -0700 Received: from userp3030.oracle.com ([156.151.31.80]) by oss.oracle.com with esmtp (Exim 4.63) (envelope-from ) id 1kP8Nh-0000VN-9Y for ocfs2-devel@oss.oracle.com; Sun, 04 Oct 2020 11:05:09 -0700 Received: from pps.filterd (userp3030.oracle.com [127.0.0.1]) by userp3030.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 094I02ko076394 for ; Sun, 4 Oct 2020 18:05:09 GMT Received: from userp2040.oracle.com (userp2040.oracle.com [156.151.31.90]) by userp3030.oracle.com with ESMTP id 33y37u7ve5-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Sun, 04 Oct 2020 18:05:07 +0000 Received: from pps.filterd (userp2040.oracle.com [127.0.0.1]) by userp2040.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 094I4naH001099 for ; Sun, 4 Oct 2020 18:05:07 GMT Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by userp2040.oracle.com with ESMTP id 33xfwsr00a-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO) for ; Sun, 04 Oct 2020 18:05:07 +0000 Received: from willy by casper.infradead.org with local (Exim 4.92.3 #3 (Red Hat Linux)) id 1kP8N5-0003mc-D3; Sun, 04 Oct 2020 18:04:31 +0000 From: "Matthew Wilcox (Oracle)" To: linux-fsdevel@vger.kernel.org Date: Sun, 4 Oct 2020 19:04:23 +0100 Message-Id: <20201004180428.14494-3-willy@infradead.org> X-Mailer: git-send-email 2.21.3 In-Reply-To: <20201004180428.14494-1-willy@infradead.org> References: <20201004180428.14494-1-willy@infradead.org> MIME-Version: 1.0 X-PDR: PASS X-Source-IP: 90.155.50.34 X-ServerName: casper.infradead.org X-Proofpoint-SPF-Result: None X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9764 signatures=668680 X-Proofpoint-Spam-Details: rule=tap_notspam policy=tap score=0 malwarescore=0 lowpriorityscore=0 phishscore=0 impostorscore=0 mlxlogscore=525 priorityscore=216 clxscore=315 bulkscore=0 suspectscore=1 spamscore=0 mlxscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2006250000 definitions=main-2010040140 X-Spam: Clean Cc: lucho@ionkov.net, stable@vger.kernel.org, clm@fb.com, ericvh@gmail.com, linux-btrfs@vger.kernel.org, jlayton@kernel.org, linux-kernel@vger.kernel.org, josef@toxicpanda.com, viro@zeniv.linux.org.uk, dsterba@suse.com, v9fs-developer@lists.sourceforge.net, idryomov@gmail.com, ceph-devel@vger.kernel.org, ocfs2-devel@oss.oracle.com Subject: [Ocfs2-devel] [PATCH 2/7] buffer: Promote to unsigned long long before shifting X-BeenThere: ocfs2-devel@oss.oracle.com X-Mailman-Version: 2.1.9 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: ocfs2-devel-bounces@oss.oracle.com Errors-To: ocfs2-devel-bounces@oss.oracle.com X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9764 signatures=668680 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 malwarescore=0 suspectscore=0 adultscore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2006250000 definitions=main-2010040140 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9764 signatures=668680 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 mlxscore=0 suspectscore=0 impostorscore=0 priorityscore=1501 clxscore=1034 phishscore=0 malwarescore=0 spamscore=0 bulkscore=0 lowpriorityscore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2006250000 definitions=main-2010040140 On 32-bit systems, this shift will overflow for files larger than 4GB. Cc: stable@vger.kernel.org Fixes: 5417169026c3 ("[FS] Implement block_page_mkwrite.") Signed-off-by: Matthew Wilcox (Oracle) --- fs/buffer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/buffer.c b/fs/buffer.c index 50bbc99e3d96..66f4765e60ee 100644 --- a/fs/buffer.c +++ b/fs/buffer.c @@ -2515,7 +2515,7 @@ int block_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf, } /* page is wholly or partially inside EOF */ - if (((page->index + 1) << PAGE_SHIFT) > size) + if (((page->index + 1ULL) << PAGE_SHIFT) > size) end = size & ~PAGE_MASK; else end = PAGE_SIZE; From patchwork Sun Oct 4 18:04:24 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 11815775 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A30941752 for ; Sun, 4 Oct 2020 18:06:02 +0000 (UTC) Received: from userp2120.oracle.com (userp2120.oracle.com [156.151.31.85]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 63CF2206B6 for ; Sun, 4 Oct 2020 18:06:02 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 63CF2206B6 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=ocfs2-devel-bounces@oss.oracle.com Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 094I5nBn191441; Sun, 4 Oct 2020 18:05:49 GMT Received: from userp3020.oracle.com (userp3020.oracle.com [156.151.31.79]) by userp2120.oracle.com with ESMTP id 33xhxmjshc-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Sun, 04 Oct 2020 18:05:49 +0000 Received: from pps.filterd (userp3020.oracle.com [127.0.0.1]) by userp3020.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 094I4xJg158736; Sun, 4 Oct 2020 18:05:48 GMT Received: from oss.oracle.com (oss-old-reserved.oracle.com [137.254.22.2]) by userp3020.oracle.com with ESMTP id 33y32nwr56-1 (version=TLSv1 cipher=AES256-SHA bits=256 verify=NO); Sun, 04 Oct 2020 18:05:48 +0000 Received: from localhost ([127.0.0.1] helo=lb-oss.oracle.com) by oss.oracle.com with esmtp (Exim 4.63) (envelope-from ) id 1kP8OJ-0000XC-P4; Sun, 04 Oct 2020 11:05:47 -0700 Received: from aserp3020.oracle.com ([141.146.126.70]) by oss.oracle.com with esmtp (Exim 4.63) (envelope-from ) id 1kP8NV-0000Ti-B8 for ocfs2-devel@oss.oracle.com; Sun, 04 Oct 2020 11:04:57 -0700 Received: from pps.filterd (aserp3020.oracle.com [127.0.0.1]) by aserp3020.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 094I4tYw156379 for ; Sun, 4 Oct 2020 18:04:57 GMT Received: from userp2030.oracle.com (userp2030.oracle.com [156.151.31.89]) by aserp3020.oracle.com with ESMTP id 33y36vq8nb-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Sun, 04 Oct 2020 18:04:57 +0000 Received: from pps.filterd (userp2030.oracle.com [127.0.0.1]) by userp2030.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 094I411Y016483 for ; Sun, 4 Oct 2020 18:04:56 GMT Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by userp2030.oracle.com with ESMTP id 33xfbg7c02-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO) for ; Sun, 04 Oct 2020 18:04:55 +0000 Received: from willy by casper.infradead.org with local (Exim 4.92.3 #3 (Red Hat Linux)) id 1kP8N5-0003mg-Jf; Sun, 04 Oct 2020 18:04:31 +0000 From: "Matthew Wilcox (Oracle)" To: linux-fsdevel@vger.kernel.org Date: Sun, 4 Oct 2020 19:04:24 +0100 Message-Id: <20201004180428.14494-4-willy@infradead.org> X-Mailer: git-send-email 2.21.3 In-Reply-To: <20201004180428.14494-1-willy@infradead.org> References: <20201004180428.14494-1-willy@infradead.org> MIME-Version: 1.0 X-PDR: PASS X-Source-IP: 90.155.50.34 X-ServerName: casper.infradead.org X-Proofpoint-SPF-Result: None X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9764 signatures=668680 X-Proofpoint-Spam-Details: rule=tap_notspam policy=tap score=1 spamscore=1 mlxscore=1 clxscore=322 impostorscore=0 lowpriorityscore=0 priorityscore=162 adultscore=0 bulkscore=0 malwarescore=0 suspectscore=1 phishscore=0 mlxlogscore=209 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2006250000 definitions=main-2010040140 X-Spam: Clean Cc: lucho@ionkov.net, stable@vger.kernel.org, clm@fb.com, ericvh@gmail.com, linux-btrfs@vger.kernel.org, jlayton@kernel.org, linux-kernel@vger.kernel.org, josef@toxicpanda.com, viro@zeniv.linux.org.uk, dsterba@suse.com, v9fs-developer@lists.sourceforge.net, idryomov@gmail.com, ceph-devel@vger.kernel.org, ocfs2-devel@oss.oracle.com Subject: [Ocfs2-devel] [PATCH 3/7] ceph: Promote to unsigned long long before shifting X-BeenThere: ocfs2-devel@oss.oracle.com X-Mailman-Version: 2.1.9 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: ocfs2-devel-bounces@oss.oracle.com Errors-To: ocfs2-devel-bounces@oss.oracle.com X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9764 signatures=668680 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0 phishscore=0 mlxlogscore=972 mlxscore=0 bulkscore=0 adultscore=0 spamscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2006250000 definitions=main-2010040140 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9764 signatures=668680 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 malwarescore=0 bulkscore=0 impostorscore=0 lowpriorityscore=0 suspectscore=0 phishscore=0 mlxlogscore=956 adultscore=0 clxscore=1034 spamscore=0 priorityscore=1501 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2006250000 definitions=main-2010040140 On 32-bit systems, this shift will overflow for files larger than 4GB. Cc: stable@vger.kernel.org Fixes: 61f68816211e ("ceph: check caps in filemap_fault and page_mkwrite") Signed-off-by: Matthew Wilcox (Oracle) Reviewed-by: Jeff Layton --- fs/ceph/addr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/ceph/addr.c b/fs/ceph/addr.c index 6ea761c84494..970e5a094035 100644 --- a/fs/ceph/addr.c +++ b/fs/ceph/addr.c @@ -1522,7 +1522,7 @@ static vm_fault_t ceph_filemap_fault(struct vm_fault *vmf) struct ceph_inode_info *ci = ceph_inode(inode); struct ceph_file_info *fi = vma->vm_file->private_data; struct page *pinned_page = NULL; - loff_t off = vmf->pgoff << PAGE_SHIFT; + loff_t off = (loff_t)vmf->pgoff << PAGE_SHIFT; int want, got, err; sigset_t oldset; vm_fault_t ret = VM_FAULT_SIGBUS; From patchwork Sun Oct 4 18:04:25 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 11815779 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C07841580 for ; Sun, 4 Oct 2020 18:06:02 +0000 (UTC) Received: from userp2120.oracle.com (userp2120.oracle.com [156.151.31.85]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 8662B206DD for ; Sun, 4 Oct 2020 18:06:02 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8662B206DD Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=ocfs2-devel-bounces@oss.oracle.com Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 094I5XpM191402; Sun, 4 Oct 2020 18:05:50 GMT Received: from userp3030.oracle.com (userp3030.oracle.com [156.151.31.80]) by userp2120.oracle.com with ESMTP id 33xhxmjshd-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Sun, 04 Oct 2020 18:05:50 +0000 Received: from pps.filterd (userp3030.oracle.com [127.0.0.1]) by userp3030.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 094I01iG076314; Sun, 4 Oct 2020 18:05:49 GMT Received: from oss.oracle.com (oss-old-reserved.oracle.com [137.254.22.2]) by userp3030.oracle.com with ESMTP id 33y37u7vx9-1 (version=TLSv1 cipher=AES256-SHA bits=256 verify=NO); Sun, 04 Oct 2020 18:05:49 +0000 Received: from localhost ([127.0.0.1] helo=lb-oss.oracle.com) by oss.oracle.com with esmtp (Exim 4.63) (envelope-from ) id 1kP8OK-0000Xl-RO; Sun, 04 Oct 2020 11:05:48 -0700 Received: from userp3020.oracle.com ([156.151.31.79]) by oss.oracle.com with esmtp (Exim 4.63) (envelope-from ) id 1kP8NY-0000UL-5B for ocfs2-devel@oss.oracle.com; Sun, 04 Oct 2020 11:05:00 -0700 Received: from pps.filterd (userp3020.oracle.com [127.0.0.1]) by userp3020.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 094I4xhQ158809 for ; Sun, 4 Oct 2020 18:04:59 GMT Received: from userp2030.oracle.com (userp2030.oracle.com [156.151.31.89]) by userp3020.oracle.com with ESMTP id 33y32nwqdh-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Sun, 04 Oct 2020 18:04:59 +0000 Received: from pps.filterd (userp2030.oracle.com [127.0.0.1]) by userp2030.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 094I44BF016523 for ; Sun, 4 Oct 2020 18:04:57 GMT Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by userp2030.oracle.com with ESMTP id 33xfbg7c13-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO) for ; Sun, 04 Oct 2020 18:04:56 +0000 Received: from willy by casper.infradead.org with local (Exim 4.92.3 #3 (Red Hat Linux)) id 1kP8N5-0003mk-R4; Sun, 04 Oct 2020 18:04:31 +0000 From: "Matthew Wilcox (Oracle)" To: linux-fsdevel@vger.kernel.org Date: Sun, 4 Oct 2020 19:04:25 +0100 Message-Id: <20201004180428.14494-5-willy@infradead.org> X-Mailer: git-send-email 2.21.3 In-Reply-To: <20201004180428.14494-1-willy@infradead.org> References: <20201004180428.14494-1-willy@infradead.org> MIME-Version: 1.0 X-PDR: PASS X-Source-IP: 90.155.50.34 X-ServerName: casper.infradead.org X-Proofpoint-SPF-Result: None X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9764 signatures=668680 X-Proofpoint-Spam-Details: rule=tap_notspam policy=tap score=0 spamscore=0 mlxscore=0 clxscore=316 impostorscore=0 lowpriorityscore=0 priorityscore=0 adultscore=0 bulkscore=0 malwarescore=0 suspectscore=1 phishscore=0 mlxlogscore=423 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2006250000 definitions=main-2010040140 X-Spam: Clean Cc: lucho@ionkov.net, stable@vger.kernel.org, clm@fb.com, ericvh@gmail.com, linux-btrfs@vger.kernel.org, jlayton@kernel.org, linux-kernel@vger.kernel.org, josef@toxicpanda.com, viro@zeniv.linux.org.uk, dsterba@suse.com, v9fs-developer@lists.sourceforge.net, idryomov@gmail.com, ceph-devel@vger.kernel.org, ocfs2-devel@oss.oracle.com Subject: [Ocfs2-devel] [PATCH 4/7] ocfs2: Promote to unsigned long long before shifting X-BeenThere: ocfs2-devel@oss.oracle.com X-Mailman-Version: 2.1.9 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: ocfs2-devel-bounces@oss.oracle.com Errors-To: ocfs2-devel-bounces@oss.oracle.com X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9764 signatures=668680 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 malwarescore=0 suspectscore=0 adultscore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2006250000 definitions=main-2010040139 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9764 signatures=668680 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 malwarescore=0 bulkscore=0 impostorscore=0 lowpriorityscore=0 suspectscore=0 phishscore=0 mlxlogscore=999 adultscore=0 clxscore=1034 spamscore=0 priorityscore=1501 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2006250000 definitions=main-2010040140 On 32-bit systems, this shift will overflow for files larger than 4GB. Cc: stable@vger.kernel.org Fixes: 35edec1d52c0 ("ocfs2: update truncate handling of partial clusters") Signed-off-by: Matthew Wilcox (Oracle) --- fs/ocfs2/alloc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/ocfs2/alloc.c b/fs/ocfs2/alloc.c index 4c1b90442d6f..26eff79ecb50 100644 --- a/fs/ocfs2/alloc.c +++ b/fs/ocfs2/alloc.c @@ -6867,7 +6867,7 @@ static void ocfs2_zero_cluster_pages(struct inode *inode, loff_t start, ocfs2_map_and_dirty_page(inode, handle, from, to, page, 1, &phys); - start = (page->index + 1) << PAGE_SHIFT; + start = (page->index + 1ULL) << PAGE_SHIFT; } out: if (pages) From patchwork Sun Oct 4 18:04:26 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 11815795 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 1E5F51580 for ; Sun, 4 Oct 2020 18:07:44 +0000 (UTC) Received: from aserp2120.oracle.com (aserp2120.oracle.com [141.146.126.78]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id E0A7B206B6 for ; Sun, 4 Oct 2020 18:07:43 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E0A7B206B6 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=ocfs2-devel-bounces@oss.oracle.com Received: from pps.filterd (aserp2120.oracle.com [127.0.0.1]) by aserp2120.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 094I4ggb081665; Sun, 4 Oct 2020 18:07:37 GMT Received: from userp3030.oracle.com (userp3030.oracle.com [156.151.31.80]) by aserp2120.oracle.com with ESMTP id 33xh8kjtya-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Sun, 04 Oct 2020 18:07:37 +0000 Received: from pps.filterd (userp3030.oracle.com [127.0.0.1]) by userp3030.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 094I02SM076463; Sun, 4 Oct 2020 18:05:36 GMT Received: from oss.oracle.com (oss-old-reserved.oracle.com [137.254.22.2]) by userp3030.oracle.com with ESMTP id 33y37u7vt7-1 (version=TLSv1 cipher=AES256-SHA bits=256 verify=NO); Sun, 04 Oct 2020 18:05:36 +0000 Received: from localhost ([127.0.0.1] helo=lb-oss.oracle.com) by oss.oracle.com with esmtp (Exim 4.63) (envelope-from ) id 1kP8O7-0000WQ-MR; Sun, 04 Oct 2020 11:05:35 -0700 Received: from aserp3020.oracle.com ([141.146.126.70]) by oss.oracle.com with esmtp (Exim 4.63) (envelope-from ) id 1kP8NV-0000Th-B6 for ocfs2-devel@oss.oracle.com; Sun, 04 Oct 2020 11:04:57 -0700 Received: from pps.filterd (aserp3020.oracle.com [127.0.0.1]) by aserp3020.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 094I4eAk156109 for ; Sun, 4 Oct 2020 18:04:57 GMT Received: from userp2030.oracle.com (userp2030.oracle.com [156.151.31.89]) by aserp3020.oracle.com with ESMTP id 33y36vq8n9-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Sun, 04 Oct 2020 18:04:57 +0000 Received: from pps.filterd (userp2030.oracle.com [127.0.0.1]) by userp2030.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 094I4QbU016960 for ; Sun, 4 Oct 2020 18:04:56 GMT Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by userp2030.oracle.com with ESMTP id 33xfbg7bxx-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO) for ; Sun, 04 Oct 2020 18:04:54 +0000 Received: from willy by casper.infradead.org with local (Exim 4.92.3 #3 (Red Hat Linux)) id 1kP8N6-0003mo-1t; Sun, 04 Oct 2020 18:04:32 +0000 From: "Matthew Wilcox (Oracle)" To: linux-fsdevel@vger.kernel.org Date: Sun, 4 Oct 2020 19:04:26 +0100 Message-Id: <20201004180428.14494-6-willy@infradead.org> X-Mailer: git-send-email 2.21.3 In-Reply-To: <20201004180428.14494-1-willy@infradead.org> References: <20201004180428.14494-1-willy@infradead.org> MIME-Version: 1.0 X-PDR: PASS X-Source-IP: 90.155.50.34 X-ServerName: casper.infradead.org X-Proofpoint-SPF-Result: None X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9764 signatures=668680 X-Proofpoint-Spam-Details: rule=tap_notspam policy=tap score=0 spamscore=0 mlxscore=0 clxscore=322 impostorscore=0 lowpriorityscore=0 priorityscore=132 adultscore=0 bulkscore=0 malwarescore=0 suspectscore=3 phishscore=0 mlxlogscore=461 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2006250000 definitions=main-2010040140 X-Spam: Clean Cc: lucho@ionkov.net, stable@vger.kernel.org, clm@fb.com, ericvh@gmail.com, linux-btrfs@vger.kernel.org, jlayton@kernel.org, linux-kernel@vger.kernel.org, josef@toxicpanda.com, viro@zeniv.linux.org.uk, dsterba@suse.com, v9fs-developer@lists.sourceforge.net, idryomov@gmail.com, ceph-devel@vger.kernel.org, ocfs2-devel@oss.oracle.com Subject: [Ocfs2-devel] [PATCH 5/7] btrfs: Promote to unsigned long long before shifting X-BeenThere: ocfs2-devel@oss.oracle.com X-Mailman-Version: 2.1.9 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: ocfs2-devel-bounces@oss.oracle.com Errors-To: ocfs2-devel-bounces@oss.oracle.com X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9764 signatures=668680 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 malwarescore=0 suspectscore=0 adultscore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2006250000 definitions=main-2010040139 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9764 signatures=668680 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 mlxscore=0 suspectscore=0 impostorscore=0 priorityscore=1501 clxscore=1034 phishscore=0 malwarescore=0 spamscore=0 bulkscore=0 lowpriorityscore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2006250000 definitions=main-2010040140 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) Reviewed-by: Josef Bacik --- 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); From patchwork Sun Oct 4 18:04:27 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 11815797 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 82804139A for ; Sun, 4 Oct 2020 18:08:01 +0000 (UTC) Received: from aserp2130.oracle.com (aserp2130.oracle.com [141.146.126.79]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 506B3206B6 for ; Sun, 4 Oct 2020 18:08:01 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 506B3206B6 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=ocfs2-devel-bounces@oss.oracle.com Received: from pps.filterd (aserp2130.oracle.com [127.0.0.1]) by aserp2130.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 094I5pDa149997; Sun, 4 Oct 2020 18:07:55 GMT Received: from userp3020.oracle.com (userp3020.oracle.com [156.151.31.79]) by aserp2130.oracle.com with ESMTP id 33xetak0rn-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Sun, 04 Oct 2020 18:07:54 +0000 Received: from pps.filterd (userp3020.oracle.com [127.0.0.1]) by userp3020.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 094I50Ua158889; Sun, 4 Oct 2020 18:05:54 GMT Received: from oss.oracle.com (oss-old-reserved.oracle.com [137.254.22.2]) by userp3020.oracle.com with ESMTP id 33y32nwr7q-1 (version=TLSv1 cipher=AES256-SHA bits=256 verify=NO); Sun, 04 Oct 2020 18:05:54 +0000 Received: from localhost ([127.0.0.1] helo=lb-oss.oracle.com) by oss.oracle.com with esmtp (Exim 4.63) (envelope-from ) id 1kP8OP-0000Zx-4M; Sun, 04 Oct 2020 11:05:53 -0700 Received: from userp3030.oracle.com ([156.151.31.80]) by oss.oracle.com with esmtp (Exim 4.63) (envelope-from ) id 1kP8Nh-0000VM-9Z for ocfs2-devel@oss.oracle.com; Sun, 04 Oct 2020 11:05:09 -0700 Received: from pps.filterd (userp3030.oracle.com [127.0.0.1]) by userp3030.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 094I01iD076314 for ; Sun, 4 Oct 2020 18:05:09 GMT Received: from userp2040.oracle.com (userp2040.oracle.com [156.151.31.90]) by userp3030.oracle.com with ESMTP id 33y37u7vbu-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Sun, 04 Oct 2020 18:05:03 +0000 Received: from pps.filterd (userp2040.oracle.com [127.0.0.1]) by userp2040.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 094I53j5002679 for ; Sun, 4 Oct 2020 18:05:03 GMT Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by userp2040.oracle.com with ESMTP id 33xfwsqyxr-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO) for ; Sun, 04 Oct 2020 18:05:03 +0000 Received: from willy by casper.infradead.org with local (Exim 4.92.3 #3 (Red Hat Linux)) id 1kP8N6-0003ms-7z; Sun, 04 Oct 2020 18:04:32 +0000 From: "Matthew Wilcox (Oracle)" To: linux-fsdevel@vger.kernel.org Date: Sun, 4 Oct 2020 19:04:27 +0100 Message-Id: <20201004180428.14494-7-willy@infradead.org> X-Mailer: git-send-email 2.21.3 In-Reply-To: <20201004180428.14494-1-willy@infradead.org> References: <20201004180428.14494-1-willy@infradead.org> MIME-Version: 1.0 X-PDR: PASS X-Source-IP: 90.155.50.34 X-ServerName: casper.infradead.org X-Proofpoint-SPF-Result: None X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9764 signatures=668680 X-Proofpoint-Spam-Details: rule=tap_notspam policy=tap score=0 malwarescore=0 lowpriorityscore=0 phishscore=0 impostorscore=0 mlxlogscore=403 priorityscore=285 clxscore=315 bulkscore=0 suspectscore=1 spamscore=0 mlxscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2006250000 definitions=main-2010040140 X-Spam: Clean Cc: lucho@ionkov.net, stable@vger.kernel.org, clm@fb.com, ericvh@gmail.com, linux-btrfs@vger.kernel.org, jlayton@kernel.org, linux-kernel@vger.kernel.org, josef@toxicpanda.com, viro@zeniv.linux.org.uk, dsterba@suse.com, v9fs-developer@lists.sourceforge.net, idryomov@gmail.com, ceph-devel@vger.kernel.org, ocfs2-devel@oss.oracle.com Subject: [Ocfs2-devel] [PATCH 6/7] btrfs: Promote to unsigned long long before shifting X-BeenThere: ocfs2-devel@oss.oracle.com X-Mailman-Version: 2.1.9 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: ocfs2-devel-bounces@oss.oracle.com Errors-To: ocfs2-devel-bounces@oss.oracle.com X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9764 signatures=668680 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0 phishscore=0 mlxlogscore=999 mlxscore=0 bulkscore=0 adultscore=0 spamscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2006250000 definitions=main-2010040140 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9764 signatures=668680 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 spamscore=0 mlxscore=0 clxscore=1034 priorityscore=1501 adultscore=0 mlxlogscore=999 phishscore=0 impostorscore=0 malwarescore=0 suspectscore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2006250000 definitions=main-2010040140 On 32-bit systems, this shift will overflow for files larger than 4GB. Cc: stable@vger.kernel.org Fixes: 53b381b3abeb ("Btrfs: RAID5 and RAID6") Signed-off-by: Matthew Wilcox (Oracle) Reviewed-by: Josef Bacik --- fs/btrfs/raid56.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/btrfs/raid56.c b/fs/btrfs/raid56.c index 255490f42b5d..5ee0a53301bd 100644 --- a/fs/btrfs/raid56.c +++ b/fs/btrfs/raid56.c @@ -1089,7 +1089,7 @@ static int rbio_add_io_page(struct btrfs_raid_bio *rbio, u64 disk_start; stripe = &rbio->bbio->stripes[stripe_nr]; - disk_start = stripe->physical + (page_index << PAGE_SHIFT); + disk_start = stripe->physical + ((loff_t)page_index << PAGE_SHIFT); /* if the device is missing, just fail this stripe */ if (!stripe->dev->bdev) From patchwork Sun Oct 4 18:04:28 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 11815785 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 6CD811752 for ; Sun, 4 Oct 2020 18:06:08 +0000 (UTC) Received: from userp2120.oracle.com (userp2120.oracle.com [156.151.31.85]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 32E54206B6 for ; Sun, 4 Oct 2020 18:06:08 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 32E54206B6 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=ocfs2-devel-bounces@oss.oracle.com Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 094I5U0x191396; Sun, 4 Oct 2020 18:06:01 GMT Received: from userp3030.oracle.com (userp3030.oracle.com [156.151.31.80]) by userp2120.oracle.com with ESMTP id 33xhxmjshs-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Sun, 04 Oct 2020 18:06:01 +0000 Received: from pps.filterd (userp3030.oracle.com [127.0.0.1]) by userp3030.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 094I61rU086053; Sun, 4 Oct 2020 18:06:01 GMT Received: from oss.oracle.com (oss-old-reserved.oracle.com [137.254.22.2]) by userp3030.oracle.com with ESMTP id 33y37u7vy7-1 (version=TLSv1 cipher=AES256-SHA bits=256 verify=NO); Sun, 04 Oct 2020 18:06:00 +0000 Received: from localhost ([127.0.0.1] helo=lb-oss.oracle.com) by oss.oracle.com with esmtp (Exim 4.63) (envelope-from ) id 1kP8OL-0000YI-Tf; Sun, 04 Oct 2020 11:05:49 -0700 Received: from aserp3020.oracle.com ([141.146.126.70]) by oss.oracle.com with esmtp (Exim 4.63) (envelope-from ) id 1kP8NZ-0000UY-QX for ocfs2-devel@oss.oracle.com; Sun, 04 Oct 2020 11:05:01 -0700 Received: from pps.filterd (aserp3020.oracle.com [127.0.0.1]) by aserp3020.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 094I4eBk156090 for ; Sun, 4 Oct 2020 18:05:01 GMT Received: from userp2040.oracle.com (userp2040.oracle.com [156.151.31.90]) by aserp3020.oracle.com with ESMTP id 33y36vq8q0-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Sun, 04 Oct 2020 18:05:01 +0000 Received: from pps.filterd (userp2040.oracle.com [127.0.0.1]) by userp2040.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 094I4pmd001386 for ; Sun, 4 Oct 2020 18:05:00 GMT Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by userp2040.oracle.com with ESMTP id 33xfwsqyxe-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO) for ; Sun, 04 Oct 2020 18:05:00 +0000 Received: from willy by casper.infradead.org with local (Exim 4.92.3 #3 (Red Hat Linux)) id 1kP8N6-0003mw-Dx; Sun, 04 Oct 2020 18:04:32 +0000 From: "Matthew Wilcox (Oracle)" To: linux-fsdevel@vger.kernel.org Date: Sun, 4 Oct 2020 19:04:28 +0100 Message-Id: <20201004180428.14494-8-willy@infradead.org> X-Mailer: git-send-email 2.21.3 In-Reply-To: <20201004180428.14494-1-willy@infradead.org> References: <20201004180428.14494-1-willy@infradead.org> MIME-Version: 1.0 X-PDR: PASS X-Source-IP: 90.155.50.34 X-ServerName: casper.infradead.org X-Proofpoint-SPF-Result: None X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9764 signatures=668680 X-Proofpoint-Spam-Details: rule=tap_notspam policy=tap score=0 malwarescore=0 lowpriorityscore=0 phishscore=0 impostorscore=0 mlxlogscore=417 priorityscore=180 clxscore=310 bulkscore=0 suspectscore=1 spamscore=0 mlxscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2006250000 definitions=main-2010040140 X-Spam: Clean Cc: lucho@ionkov.net, stable@vger.kernel.org, clm@fb.com, ericvh@gmail.com, linux-btrfs@vger.kernel.org, jlayton@kernel.org, linux-kernel@vger.kernel.org, josef@toxicpanda.com, viro@zeniv.linux.org.uk, dsterba@suse.com, v9fs-developer@lists.sourceforge.net, idryomov@gmail.com, ceph-devel@vger.kernel.org, ocfs2-devel@oss.oracle.com Subject: [Ocfs2-devel] [PATCH 7/7] btrfs: Promote to unsigned long long before multiplying X-BeenThere: ocfs2-devel@oss.oracle.com X-Mailman-Version: 2.1.9 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: ocfs2-devel-bounces@oss.oracle.com Errors-To: ocfs2-devel-bounces@oss.oracle.com X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9764 signatures=668680 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 malwarescore=0 suspectscore=0 adultscore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2006250000 definitions=main-2010040140 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9764 signatures=668680 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 malwarescore=0 bulkscore=0 impostorscore=0 lowpriorityscore=0 suspectscore=0 phishscore=0 mlxlogscore=999 adultscore=0 clxscore=1034 spamscore=0 priorityscore=1501 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2006250000 definitions=main-2010040140 On 32-bit systems, these shifts will overflow for files larger than 4GB. Add helper functions to avoid this problem coming back. Cc: stable@vger.kernel.org Fixes: 73ff61dbe5ed ("Btrfs: fix device replace of a missing RAID 5/6 device") Fixes: be50a8ddaae1 ("Btrfs: Simplify scrub_setup_recheck_block()'s argument") Fixes: ff023aac3119 ("Btrfs: add code to scrub to copy read data to another disk") Fixes: b5d67f64f9bc ("Btrfs: change scrub to support big blocks") Fixes: a2de733c78fa ("btrfs: scrub") Signed-off-by: Matthew Wilcox (Oracle) --- fs/btrfs/scrub.c | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/fs/btrfs/scrub.c b/fs/btrfs/scrub.c index 354ab9985a34..ccbaf9c6e87a 100644 --- a/fs/btrfs/scrub.c +++ b/fs/btrfs/scrub.c @@ -1262,12 +1262,17 @@ static inline void scrub_stripe_index_and_offset(u64 logical, u64 map_type, } } +static u64 sblock_length(struct scrub_block *sblock) +{ + return (u64)sblock->page_count * PAGE_SIZE; +} + static int scrub_setup_recheck_block(struct scrub_block *original_sblock, struct scrub_block *sblocks_for_recheck) { struct scrub_ctx *sctx = original_sblock->sctx; struct btrfs_fs_info *fs_info = sctx->fs_info; - u64 length = original_sblock->page_count * PAGE_SIZE; + u64 length = sblock_length(original_sblock); u64 logical = original_sblock->pagev[0]->logical; u64 generation = original_sblock->pagev[0]->generation; u64 flags = original_sblock->pagev[0]->flags; @@ -1610,6 +1615,11 @@ static void scrub_write_block_to_dev_replace(struct scrub_block *sblock) } } +static u64 sbio_length(struct scrub_bio *sbio) +{ + return (u64)sbio->page_count * PAGE_SIZE; +} + static int scrub_write_page_to_dev_replace(struct scrub_block *sblock, int page_num) { @@ -1659,10 +1669,9 @@ static int scrub_add_page_to_wr_bio(struct scrub_ctx *sctx, bio->bi_iter.bi_sector = sbio->physical >> 9; bio->bi_opf = REQ_OP_WRITE; sbio->status = 0; - } else if (sbio->physical + sbio->page_count * PAGE_SIZE != + } else if (sbio->physical + sbio_length(sbio) != spage->physical_for_dev_replace || - sbio->logical + sbio->page_count * PAGE_SIZE != - spage->logical) { + sbio->logical + sbio_length(sbio) != spage->logical) { scrub_wr_submit(sctx); goto again; } @@ -2005,10 +2014,8 @@ static int scrub_add_page_to_rd_bio(struct scrub_ctx *sctx, bio->bi_iter.bi_sector = sbio->physical >> 9; bio->bi_opf = REQ_OP_READ; sbio->status = 0; - } else if (sbio->physical + sbio->page_count * PAGE_SIZE != - spage->physical || - sbio->logical + sbio->page_count * PAGE_SIZE != - spage->logical || + } else if (sbio->physical + sbio_length(sbio) != spage->physical || + sbio->logical + sbio_length(sbio) != spage->logical || sbio->dev != spage->dev) { scrub_submit(sctx); goto again; @@ -2094,7 +2101,7 @@ static void scrub_missing_raid56_pages(struct scrub_block *sblock) { struct scrub_ctx *sctx = sblock->sctx; struct btrfs_fs_info *fs_info = sctx->fs_info; - u64 length = sblock->page_count * PAGE_SIZE; + u64 length = sblock_length(sblock); u64 logical = sblock->pagev[0]->logical; struct btrfs_bio *bbio = NULL; struct bio *bio;