On Wed, 2017-07-19 at 10:22 -0400, Olga Kornievskaia wrote: > On Wed, Jul 19, 2017 at 9:58 AM, Mkrtchyan, Tigran > <tigran.mkrtchyan@xxxxxxx> wrote: > > Dear friends, > > > > By running xfstest (generic/013) I have discovered client side > > misbehavior. > > Consider the following test code: > > > > ----- > > > > #include <stdio.h> > > #include <stdlib.h> > > #include <unistd.h> > > #include <fcntl.h> > > > > > > int main(int argc, char **argv) > > { > > > > if (argc != 2) { > > fprintf(stderr, "Usage: %s <path>\n", argv[0]); > > exit(1); > > } > > > > int rc = truncate(argv[1], 8192); > > if (rc < 0) { > > perror("Failed to truncate the file"); > > exit(4); > > } > > exit(0); > > } > > > > > > ---- > > > > The expectation is that client will send a valid open stateid with > > SETATTR (rfc7530#16.32.4). > > However, this is not the case - client just send's a SETATTR with > > size, but without any open. > > SETATTR is allowed to send an all-zero stateid: > > RFC7530 9.1.4.3 > > Anonymous Stateid: When "other" and seqid are both zero, the stateid > is treated as a special anonymous stateid, which can be used in > READ, WRITE, and SETATTR requests to indicate the absence of > any > open state associated with the request. Agreed. As Olga says, there is no spec requirement that the client open the file in order to service a truncate() call, so this behaviour is by design. Cheers Trond -- Trond Myklebust Linux NFS client maintainer, PrimaryData trond.myklebust@xxxxxxxxxxxxxxx ��.n��������+%������w��{.n�����{��w���jg��������ݢj����G�������j:+v���w�m������w�������h�����٥