Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1C772184520 for ; Mon, 25 Nov 2024 14:23:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732544589; cv=none; b=sDv5a+I4TAZzEkqzZC1NoBFTJcLlgRSNhe6pmmBveqHYmIKD2KKeD12iuTppwzXky0z2TDxtbGwKjXLERsXYzDpn4q51Ndoud0uRQpjrQ3Xaq54Fk8ZE9x+T/tUdnjZkP49X2u/+zMGp66wZnV3Ob4yOqsJk6R4HZLdjnwCiR00= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732544589; c=relaxed/simple; bh=mzFtFi8tS5ParM7f2yAdocYFReuH1+YTGrldb7G7fvA=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=Tb4+I35T2Xuv43D1KG5ACQh0QZpMbb2tYmkG7x4Qt/qzmuGPnQGAYb5PKEGFxc2ri3f3StzVy3VkFurT8kxLVTNCAzRmsfyw/MT3l3jfZVo8M7l+/5AOhbb8gQoe8xCDg6Rwil0T8NIcr2g3o8/8zvVomUoXuhTAJynLXezOCig= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=mcQ8HskA; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="mcQ8HskA" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 02824C4CECE; Mon, 25 Nov 2024 14:23:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1732544588; bh=mzFtFi8tS5ParM7f2yAdocYFReuH1+YTGrldb7G7fvA=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=mcQ8HskASIOtyrXRQIGis/4lLFYBgfvVb7lOlKfS4H2N32tBV2WheSF7Dk8eDG+vm pAj41ekqX5W9gZBf8q2884tY/9TLltMGjwQAY3VtNNlrAMQXIb9PoUa5lr7+wRZxZE 3mho9YFhYewxwjIbGE1cPohYgU+RnWdRjJm1ZQUfJR9Zhr2okm1rsMRPE5NebUOqsZ MxgIUJSMpC2Qzwo0Qp9w3iA0dj/nmFjcLkorSn2m2wo83nkatdZB/QyO/2b7MHC/nV ZT4boVW+romiqGDKJCRrSuZUpCRrIR7vTrn5Du8Eck9FFvzyv1lF0/g1J6SOXwtS0j buRMdlN4C/qFw== Date: Mon, 25 Nov 2024 15:23:04 +0100 From: Christian Brauner To: Matthew Wilcox Cc: Christoph Hellwig , Jan Kara , Al Viro , Jens Axboe , linux-fsdevel@vger.kernel.org Subject: Re: [PATCH 2/2] fs: require FMODE_WRITE for F_SET_RW_HINT Message-ID: <20241125-panda-kratzen-5b00ff0bd8f7@brauner> References: <20241122122931.90408-1-hch@lst.de> <20241122122931.90408-3-hch@lst.de> <20241122125342.vmmjokiilvnuifuf@quack3> <20241122161547.GA7787@lst.de> Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: On Fri, Nov 22, 2024 at 04:40:31PM +0000, Matthew Wilcox wrote: > On Fri, Nov 22, 2024 at 05:15:47PM +0100, Christoph Hellwig wrote: > > On Fri, Nov 22, 2024 at 01:53:42PM +0100, Jan Kara wrote: > > > Here I'm not so sure. Firstly, since you are an owner this doesn't add any > > > additional practical restriction. Secondly, you are not changing anything > > > on disk, just IO hints in memory... Thirdly, we generally don't require > > > writeable fd even to do file attribute changes (like with fchmod, fchown, > > > etc.). So although the check makes some sense, it seems to be mostly > > > inconsistent with how we treat similar stuff. > > > > As I said I'm not quite convince either, so just doing the first one > > is probably fine. > > We do require FMODE_WRITE to do a dedupe, which isn't exactly the same > but is similar in concept (we're not changing the content of the file; > we're changing how it's laid out on storage). So I think it's reasonable > to require FMODE_WRITE to set the write hints. I tend to agree with Jan. I think the dedupe case is different because you actually use the file to perform a write(-like) operation whereas toggling write hints is just setting an option.