Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 27 Feb 2020 15:31:12 -0800
From:      Luoqi Chen <luoqi.chen@gmail.com>
To:        Alan Batie <alan@peak.org>
Cc:        freebsd-fs <freebsd-fs@freebsd.org>
Subject:   Re: Linux could write to read only files on FreeBSD NFS server
Message-ID:  <CAHJqQjtLA9sFgczxC3xRZVXj6QzK-xLyz-R_L5y68vq8bw=xEg@mail.gmail.com>
In-Reply-To: <d73aea39-c5c2-e8ce-3745-bfd49fd69664@peak.org>
References:  <CAHJqQjuEVpL4xV1dAf6scFqFfMNm1gY3jOaO64ZQJTCQi_qzcQ@mail.gmail.com> <707243CD-C67E-4DAD-AC5A-68EC11CFFDFD@lysator.liu.se> <6EC06026-DA28-4CAC-8D56-5C7856D4625E@lysator.liu.se> <YTBPR01MB3374713F573B548791A22F98DDEB0@YTBPR01MB3374.CANPRD01.PROD.OUTLOOK.COM> <CAHJqQjsP-w9LAS4AV64Pu9Jmv0kVFodKdT_jLUcyop3sNVh_EA@mail.gmail.com> <d73aea39-c5c2-e8ce-3745-bfd49fd69664@peak.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, Feb 27, 2020 at 3:12 PM Alan Batie <alan@peak.org> wrote:

> On 2/27/20 2:58 PM, Luoqi Chen wrote:
> > One more piece of information that might help: this behavior started
> > somewhere between centos 5 and 6, kernel 2.6.18 and 2.6.32, i.e., the
> same
> > script would fail on 2.6.18. Timing wise I believe it coincided with the
> > introduction of nfsv4.
> >
> > Even if this is a linux bug, given its dominant position, we don't have
> > much of a choice but to try to be compatible. Does anyone have say access
> > to a netapp and see how it behaves?
>
> Is this what you mean?
>
> <admin03.peak.org> [101] $ df .
> Filesystem           1K-blocks     Used Available Use% Mounted on
> filer01-cvo.peak.org:/vol/admin
>                      167772160 73704064  94068096  44% /filer01/cvo-admin
> <admin03.peak.org> [102] $ rm -f x
> <admin03.peak.org> [103] $ touch x
> <admin03.peak.org> [104] $ chmod 000 x
> <admin03.peak.org> [105] $ ls -l x
> ----------. 1 alan wheel 0 Feb 27 15:01 x
> <admin03.peak.org> [106] $ echo foo > x
> -bash: x: Permission denied
> <admin03.peak.org> [107] $ chmod 600 x
> <admin03.peak.org> [108] $ cat x
> <admin03.peak.org> [109] $ cat /etc/redhat-release
> CentOS release 6.10 (Final)
>
>
> This works the same way on a truenas server:
>
> <admin03.peak.org> [122] $ rm x
> <admin03.peak.org> [123] $ df .
> Filesystem             1K-blocks     Used   Available Use% Mounted on
> tnas01-cvo.fs10g.peak.org:/mnt/zdata/nfs/admin
>                      78257431296 54539008 78202892288   1%
> /tnas01-cvo/admin
> <admin03.peak.org> [124] $ touch x
> <admin03.peak.org> [125] $ chmod 000 x
> <admin03.peak.org> [126] $ ls -l x
> ----------. 1 alan wheel 0 Feb 27 15:05 x
> <admin03.peak.org> [127] $ echo foo > x
> -bash: x: Permission denied
> <admin03.peak.org> [128] $ chmod 600 x
> <admin03.peak.org> [129] $ cat x
> <admin03.peak.org> [130] $
>
> However it also does the same on a native FreeBSD 11 server:
>
> <zbackups02.peak.org> [116] $ uname -a
> FreeBSD zbackups02.peak.org 11.3-RELEASE-p3 FreeBSD 11.3-RELEASE-p3 #0:
> Mon Aug 19 21:08:43 UTC 2019
> root@amd64-builder.daemonology.net:/usr/obj/usr/src/sys/GENERIC  amd64
>
> <zmail03-admin.peak.org> [105] $ cat /etc/redhat-release
> CentOS release 6.10 (Final)
> <zmail03-admin.peak.org> [106] $ df .
> Filesystem            1K-blocks     Used  Available Use% Mounted on
> zbackups02.peak.org:/zbackups/zmail03-admin
>                      5039303296 91682304 4947620992   2% /zbackups
> <zmail03-admin.peak.org> [107] $ touch x
> <zmail03-admin.peak.org> [108] $ chmod 0 x
> <zmail03-admin.peak.org> [109] $ ls -l x
> ----------. 1 alan root 0 Feb 27 15:08 x
> <zmail03-admin.peak.org> [110] $ echo foo > x
> -bash: x: Permission denied
> <zmail03-admin.peak.org> [111] $ chmod 600 x
> <zmail03-admin.peak.org> [112] $ cat x
>

Yes, except to leave the read bit(s) on. I can confirm that the write would
fail on centos 6/7/8 if all bits are cleared.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAHJqQjtLA9sFgczxC3xRZVXj6QzK-xLyz-R_L5y68vq8bw=xEg>