Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp366889ybz; Wed, 29 Apr 2020 01:31:45 -0700 (PDT) X-Google-Smtp-Source: APiQypJSTUTgmYpzHbiUtyrqmvea6TW9a2I3ZiyrEh6+bKtvdb6kruadsALiseLapinlFL4RNP3J X-Received: by 2002:aa7:c983:: with SMTP id c3mr1449694edt.343.1588149105254; Wed, 29 Apr 2020 01:31:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588149105; cv=none; d=google.com; s=arc-20160816; b=J3Y5Vsgn6AGKA6SDYwjPNWectHFfdgkdA2D9TbMzOdfZ0oMyzZ81LITAGEP3I5aTt4 C+00dauMlIbB/Ng+w5w4C5mcX3TV07AkUjX9FWtC2IUR5HNDonqoGFFWNkn0Cj7kVJrL zU5R7j/Sx5n4R/JdoEOObd7cKGhSdTDEfDX1A0MhremW5nWl9U1gSCvnc36c0guuF3KE AFamNwbfJ2qTEHnCy1L0mTDHYGkgvE2IwsD5ANxmfweTzvo2L9ML+XSSRtEL4F0dCMiC 6D2cCYhVSpnwH5QJ0bVN539/Rh09T6cxKRDBtyt+YK+GGm7QbyomXrobqWR2lH9RAHaY PYNg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date:from :references:cc:to:subject; bh=NRec81I4DsRGVZKCL10qJM4tJM+f91WGY3ccCywYgDM=; b=GKe8FXEwYSw6qui09XsqjEfXMpfneHvUW83bWT5X5un2pH1ll1i27/49DhvayA190P LM+R39V/U5AO5+hZmOA+pKN9wfcs69dk4XtYh+NZJ9oPAkye+uvbhdl3ydGGG3PWUQgQ aay1xIEROFPxoDpXqjfeOEUuyWnLxaZueP2Hd5pQtcqVeLUESGrhnVpDpkYrmRrSz+mP s8UNnY64W+jAGu3ou71v8IBGRjo36Z6eVkKW30MxvonM0tmL9sTGME0YkEhBXf3PgE1j Mr5qrDakAg4m4bhqXfwBu5XWzVcEh4x2yH6HxUumgtc9Uu/VguyIaYl+pDzm+CKvzVGE 0GcA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s26si2961530edy.349.2020.04.29.01.31.10; Wed, 29 Apr 2020 01:31:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726436AbgD2IbG (ORCPT + 99 others); Wed, 29 Apr 2020 04:31:06 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:56774 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726355AbgD2IbF (ORCPT ); Wed, 29 Apr 2020 04:31:05 -0400 Received: from pps.filterd (m0098399.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 03T83YgD115099; Wed, 29 Apr 2020 04:30:47 -0400 Received: from ppma03fra.de.ibm.com (6b.4a.5195.ip4.static.sl-reverse.com [149.81.74.107]) by mx0a-001b2d01.pphosted.com with ESMTP id 30mhc23ug7-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 29 Apr 2020 04:30:47 -0400 Received: from pps.filterd (ppma03fra.de.ibm.com [127.0.0.1]) by ppma03fra.de.ibm.com (8.16.0.27/8.16.0.27) with SMTP id 03T8Kpd4025685; Wed, 29 Apr 2020 08:30:44 GMT Received: from b06cxnps3074.portsmouth.uk.ibm.com (d06relay09.portsmouth.uk.ibm.com [9.149.109.194]) by ppma03fra.de.ibm.com with ESMTP id 30mcu59mdy-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 29 Apr 2020 08:30:44 +0000 Received: from d06av26.portsmouth.uk.ibm.com (d06av26.portsmouth.uk.ibm.com [9.149.105.62]) by b06cxnps3074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 03T8UgdM3408150 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 29 Apr 2020 08:30:42 GMT Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 73C9DAE04D; Wed, 29 Apr 2020 08:30:42 +0000 (GMT) Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 69A0DAE051; Wed, 29 Apr 2020 08:30:39 +0000 (GMT) Received: from localhost.localdomain (unknown [9.199.33.252]) by d06av26.portsmouth.uk.ibm.com (Postfix) with ESMTP; Wed, 29 Apr 2020 08:30:39 +0000 (GMT) Subject: Re: [PATCHv2] fibmap: Warn and return an error in case of block > INT_MAX To: Matthew Wilcox Cc: linux-fsdevel@vger.kernel.org, linux-xfs@vger.kernel.org, Alexander Viro , "Darrick J . Wong" , Christoph Hellwig , Jan Kara , tytso@mit.edu, "Aneesh Kumar K . V" , linux-ext4@vger.kernel.org, Jan Kara , Christoph Hellwig References: <58f0c64a3f2dbd363fb93371435f6bcaeeb7abe4.1588058868.git.riteshh@linux.ibm.com> <20200428114141.GL29705@bombadil.infradead.org> From: Ritesh Harjani Date: Wed, 29 Apr 2020 14:00:38 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.7.2 MIME-Version: 1.0 In-Reply-To: <20200428114141.GL29705@bombadil.infradead.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Message-Id: <20200429083039.69A0DAE051@d06av26.portsmouth.uk.ibm.com> X-TM-AS-GCONF: 00 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.138,18.0.676 definitions=2020-04-29_02:2020-04-28,2020-04-29 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 impostorscore=0 priorityscore=1501 adultscore=0 lowpriorityscore=0 spamscore=0 bulkscore=0 mlxlogscore=999 phishscore=0 mlxscore=0 malwarescore=0 clxscore=1015 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2003020000 definitions=main-2004290062 Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org On 4/28/20 5:11 PM, Matthew Wilcox wrote: > On Tue, Apr 28, 2020 at 01:08:31PM +0530, Ritesh Harjani wrote: >> @@ -71,6 +72,13 @@ static int ioctl_fibmap(struct file *filp, int __user *p) >> block = ur_block; >> error = bmap(inode, &block); >> >> + if (block > INT_MAX) { >> + error = -ERANGE; >> + pr_warn_ratelimited("[%s/%d] FS (%s): would truncate fibmap result\n", >> + current->comm, task_pid_nr(current), >> + sb->s_id); > > Why is it useful to print the pid? For e.g. a case where you have pthreads. pid could be different there. > And why print the superblock when we could print the filename instead? > We have a struct file, so we can printk("%pD4", filp) to print the > last four components of the pathname. > Sure, let me use below print msg then. This should cover everything now If no objections, I could send this in v3. Pls, do let me know if otherwise. Since this has changed again from the 1st version, will drop all Reviewed-by: and you could directly review v3 then. pr_warn_ratelimited("[%s/%d] FS: %s File: %pD4 would truncate fibmap result\n", current->comm, task_pid_nr(current), sb->s_id, filp); About %pD from (Documentation/core-api/printk-formats.rst) ======================================================== <..> %pd{,2,3,4} %pD{,2,3,4} For printing dentry name; if we race with :c:func:`d_move`, the name might be a mix of old and new ones, but it won't oops. %pd dentry is a safer equivalent of %s dentry->d_name.name we used to use, %pd prints ``n`` last components. %pD does the same thing for struct file. -ritesh