Received: by 10.192.165.148 with SMTP id m20csp3013543imm; Mon, 7 May 2018 05:18:38 -0700 (PDT) X-Google-Smtp-Source: AB8JxZpAe38E6l7ke4Hz6r6iW2bqhsSCToCKXBMi6/s/5fglfV/7CeTvyu/CTnSUyLK7ydej4Q3x X-Received: by 2002:a63:62c6:: with SMTP id w189-v6mr30506408pgb.263.1525695518679; Mon, 07 May 2018 05:18:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525695518; cv=none; d=google.com; s=arc-20160816; b=FA5+sWShXZNZ5KG7ng80H5WBeIy5W5T8Ghk5akGEowZka9CYLVMJL92jN4PBauLyZU BL+aU520xJZYqA0KfkCGuClTAB1ZcMTjV0rs0F7H9vkViQtZNBxtFZzlbXJ3fAX89KEg 8X+oR3q/nGIdfhefWzECkX5JmDfEUQF+nR0daisr+ZhwfFaRV7nBODa4DnoiKdWG2TkH eMpmDknROVVqj8jVMq3aj5Gcv8dewr/qsbWHKKy/wwAaY68SWc2+Hwithd+e5+AHqha8 GqAhwmoYMeumbW/JQgx90/6v9yol8F9v3nLPZAk1M4+XXp+qmJPizYeGDreWRSEjwF10 fhag== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=worwTy3ee42JGQUCmi7y1F7gdrfTQi4DPdh4wY8Wu8E=; b=yUKaXayE3B16BVDCNpZY0tc9+ieGcwEIVZ6j850C5UYEg4lARwxmQ8XTFELxCLeX72 JFPNmQ0sZYZzDjpm2YROOypjAW1fc8hAxtY1jhk2RWCtWthg5b3T3XMa4xQGU9Moe2NT LzRkovsaBrN66YQVgBrr5HZbyoRqWOIwBNN8mb3M0IKd+MYbzYHpyUm3+0n+OW93GnBG o1uAYin/d5jvgfC+/deUjiP2tByqfmTYdL2C4I9SrS84oEYxzBmSJwjmuYtI1v6zpJ86 Cmw1iTtOsfF9u73S7oZug9TCJIlSEmGBtzMOpaMAVqHwAPUBogrJYCw5/YihiK4QMKUR gbRg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=XLdaZR8j; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f39-v6si22413842plb.572.2018.05.07.05.18.23; Mon, 07 May 2018 05:18:38 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=XLdaZR8j; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752007AbeEGMSL (ORCPT + 99 others); Mon, 7 May 2018 08:18:11 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:42654 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751978AbeEGMSK (ORCPT ); Mon, 7 May 2018 08:18:10 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=worwTy3ee42JGQUCmi7y1F7gdrfTQi4DPdh4wY8Wu8E=; b=XLdaZR8jWs/HGpvfonmTv+kXB Zne9vHrUOK2KSC9XPExycNluxbEs/xK5j1JrU/l0Rdzakh+iGbQCAw68zgCRKrRiE5tFlKLI+Nm3+ OBmmbUhvFnXA7fvnWi6c9kDlw9VQ9hnOWzgpdTR5eVRuA5Mu4OxjcrQ+ZJwYd3WDhoidw2unC76mE YJEHIobWZKXIYZGN/ZtEuT/P+U2EM7vfBhIqhigej2lkVhlQLgedFHq92YswLkm4LE8JeqBohR4ix rpzWG1gPxvzfax7a9rlPNeqyhPNQL2JbvvNoIejKMgkZKRUAH1HCA/C+pldQNrC/N9nZVhrlVIzm5 tTubkvK6A==; Received: from willy by bombadil.infradead.org with local (Exim 4.90_1 #2 (Red Hat Linux)) id 1fFf5a-00053Q-Ra; Mon, 07 May 2018 12:17:58 +0000 Date: Mon, 7 May 2018 05:17:58 -0700 From: Matthew Wilcox To: Miklos Szeredi Cc: Al Viro , linux-fsdevel , lkml , Amir Goldstein Subject: Re: [PATCH 1/3] vfs: dedpue: return s64 Message-ID: <20180507121758.GD18116@bombadil.infradead.org> References: <20180507082108.28186-1-mszeredi@redhat.com> <20180507082108.28186-2-mszeredi@redhat.com> <20180507111142.GA18116@bombadil.infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.2 (2017-12-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, May 07, 2018 at 01:32:09PM +0200, Miklos Szeredi wrote: > On Mon, May 7, 2018 at 1:11 PM, Matthew Wilcox wrote: > > On Mon, May 07, 2018 at 10:21:06AM +0200, Miklos Szeredi wrote: > >> f_op->dedupe_file_range() gets a u64 length to dedup and returns an ssize_t > >> actual length deduped. This breaks badly on 32bit archs since the returned > >> length will be truncated and possibly overflow into the sign bit (xfs and > >> ocfs2 are affected, btrfs limits actual length to 16MiB). > >> > >> Returning s64 should be good, since clone_verify_area() makes sure that the > >> supplied length doesn't overflow. > > > > Why s64 rather than loff_t? Particularly since the next patch turns > > the paramters into loff_t. > > Next patch turns the offsets into loff_t and leaves "len" as u64. A > size is definitely not an offset, I'd consider changing the type of > "len" to loff_t a misuse. Usually a size is the size of something in memory. The length of something on storage is definitely an loff_t. Look at fallocate() for an example. You could also argue that lseek where whence is set to anything other than SEEK_SET is also being used as a length rather than an absolute offset. We also already use 'loff_t len' as an argument to vfs_dedupe_file_range_compare().