From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1161779AbbKTCN4 (ORCPT ); Thu, 19 Nov 2015 21:13:56 -0500 Received: from mail-ig0-f177.google.com ([209.85.213.177]:38092 "EHLO mail-ig0-f177.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757952AbbKTCNy (ORCPT ); Thu, 19 Nov 2015 21:13:54 -0500 MIME-Version: 1.0 In-Reply-To: <20151119232635.GI22011@ZenIV.linux.org.uk> References: <20151119232635.GI22011@ZenIV.linux.org.uk> Date: Thu, 19 Nov 2015 18:13:53 -0800 X-Google-Sender-Auth: b2_ZCcGE0Lgn5Y5vr1rX9iQMMBQ Message-ID: Subject: Re: [RFC] readlink()-related oddities From: Linus Torvalds To: Al Viro Cc: linux-fsdevel , Linux Kernel Mailing List , LSM List , Miklos Szeredi , David Howells Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Nov 19, 2015 at 3:26 PM, Al Viro wrote: > > 1) atime updates, according to POSIX, should happen in case of success. > For example, giving readlink(2) an unmapped buffer should _not_ touch > atime. Neither should calling readlink(2) in case if ->readlink() method > returns e.g. -EIO or -ENOMEM. We do atime update in those cases. Looks > like a bug and unless there's a good reason to keep that behaviour, I'd > rather have it do what POSIX says. I really don't think anybody cares, but I also don't think anybody cares about the current behavior, so we can certainly fix it to match POSIX wording, and just move it a bit lower after checking the return value from ->realink(). > 3) normally, readlink(2) fails for non-symlinks. Moreover, according to > POSIX it should do so (with -EINVAL). I don't think POSIX is necessarily relevant here. We have had magic file behavior outside the scope of POSIX before, and we will have it in the future. It makes perfect sense to use readlink() for management tools for automounting, even if the normal oepration is to treat the thing as a directory. Not everything is within the domain of POSIX. Linus