Path: csiph.com!fu-berlin.de!bofh.it!news.nic.it!robomod From: Linus Torvalds Newsgroups: linux.kernel Subject: Re: [RFC] readlink()-related oddities Date: Fri, 20 Nov 2015 03:20:01 +0100 Message-ID: References: X-Original-To: Al Viro Dkim-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; bh=gBnoLhIkhN+K4iV9/ZaVbZLOvOvShcdvK+CIfcpkvuw=; b=xIr+TFIpTkHZJwZ3WzgXL4oG0ed0NI2Ir3EdfBGH/mkP81b512CcizUUnIk40f8fj1 oQqY5tzVO101Z1ahoa/DYEgzJy9zXSvSC1/KGbg/U5z8cMX1LtZnyj0sdgwvm2nK62K+ BMIuETSNgH9Z+clhDp7idKMmgia3L4R6sjzQ4SCMQZmvyoeKvIbdJu9+0D26RmxZ5VF1 zLRYNMUfs82BeWLJc1J7UmQI7qZRs3LXvGldYegbRq9wbFBf9HtFBvQLlSpF7VNMd4uT 2rcrSzvis6DizOuPkV8lre3JJdYEbt87Tc4E4ZEYV1cq7ahIeiv9DRfMHK5lyOPoFgLo aw9g== Dkim-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; bh=gBnoLhIkhN+K4iV9/ZaVbZLOvOvShcdvK+CIfcpkvuw=; b=RAba6sVTml+Mg9+JYtBiSK2r/GzlUQyzeT5WcYr24GJAMwYPH0tk90wBsHezBBEYsf nahqFdkkCAf2ohIM4FdIQg+wmmB0oYz8dNUXI/sKP4E8n0bxztni0NX5QcVgDn0WYa98 6bFckqA1hzDGTmxpq0awqQFDQPuwglYj3iboY= MIME-Version: 1.0 X-Received: by 10.50.50.202 with SMTP id e10mr939665igo.25.1447985633808; Thu, 19 Nov 2015 18:13:53 -0800 (PST) X-Google-Sender-Auth: b2_ZCcGE0Lgn5Y5vr1rX9iQMMBQ Content-Type: text/plain; charset=UTF-8 Sender: robomod@news.nic.it List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Approved: robomod@news.nic.it Lines: 32 Organization: linux.* mail to news gateway X-Original-Cc: linux-fsdevel , Linux Kernel Mailing List , LSM List , Miklos Szeredi , David Howells X-Original-Date: Thu, 19 Nov 2015 18:13:53 -0800 X-Original-Message-ID: X-Original-References: <20151119232635.GI22011@ZenIV.linux.org.uk> X-Original-Sender: linux-kernel-owner@vger.kernel.org Xref: csiph.com linux.kernel:1273683 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 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/