Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp5823102imm; Tue, 26 Jun 2018 19:36:09 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJvJJyEa2reoHAF/dQaFabbswlw7WICRJ3XTU9IzECueQR+tmAqiwYpte/jGNARt0vhXoN7 X-Received: by 2002:a17:902:822:: with SMTP id 31-v6mr4092447plk.172.1530066969683; Tue, 26 Jun 2018 19:36:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530066969; cv=none; d=google.com; s=arc-20160816; b=t8HudEtYARArAoTHSTIIGfyQNR9AVrooV9T9jTAIdgkZvGmiINucePIMxMG7rhV1XW ZMvsh15GbUCm/g0lABMgm0yjChiN9Ar+I3X3SNgloKTJv3rWQovBhoRLOrXbLnq3lwIz hDZVWe/KLlp4r6cln7p3Z2b9bege+mRIHZkvlYfNM2wUtd4UzX4pXBOUUlskapXcGNE1 ku6cvuyS0hoatP3gnk4GRnKtsOcpS//4R3cEDk1pgoBpTbOSulsA44yqrE8leMcgcdoL J/POul+FXxBudl2wLIeYxa7BGeLz/BU9gH4FyFG0Y7iJ/QmRNAaMh2IQvGDtNsHi+EE5 jGOw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:thread-index:thread-topic :content-transfer-encoding:mime-version:subject:references :in-reply-to:message-id:cc:to:from:date:arc-authentication-results; bh=nxlL42jTx1vFoP/dTgOUD3hYSmjinJq7FF56Izudcrc=; b=nkHlcOqBPaVbncBtI974J6WjgMfCwTnIrtuZwqgyTstGkXqbLt6kXKDa47p2MI3Hre +d3IbXkxqVSpcXZrkRh8qQxSaMQ+vmoiB05IlOCpyYjw5G4xSY/BdHa6iG394kQOW8l+ nPTW7VHh4kh6x39v8z8cJspvo8DF1IJF3039iCFZlTsTrZAPTD7yx6OFDK9LAaAUYFOv Jw2UJwNgFs5tdjKTqUe5/cJd9ORd5d8NA+tBwKNPThr9LZAXBye1QkQYHvTblNcGBz6C 0HSP8D94AMQiEPkGsVLYOvr8FQ8fPMsaoL1OqAq4ktJYlnpu8qPyhcxrnqzAKMAAhKmY w6VQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 68-v6si2795841pla.505.2018.06.26.19.35.55; Tue, 26 Jun 2018 19:36:09 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934634AbeF0BLn (ORCPT + 99 others); Tue, 26 Jun 2018 21:11:43 -0400 Received: from mx1.redhat.com ([209.132.183.28]:43080 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933723AbeF0BLl (ORCPT ); Tue, 26 Jun 2018 21:11:41 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id BCF1D308FB8E; Wed, 27 Jun 2018 01:11:41 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A83CC7A04C; Wed, 27 Jun 2018 01:11:41 +0000 (UTC) Received: from zmail25.collab.prod.int.phx2.redhat.com (zmail25.collab.prod.int.phx2.redhat.com [10.5.83.31]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 886171800B68; Wed, 27 Jun 2018 01:11:41 +0000 (UTC) Date: Tue, 26 Jun 2018 21:11:40 -0400 (EDT) From: Ronnie Sahlberg To: Steve French Cc: labbott@redhat.com, CIFS , samba-technical , LKML , Adam Williamson Message-ID: <1332132554.10805313.1530061900159.JavaMail.zimbra@redhat.com> In-Reply-To: References: <77967693-040b-734a-8e18-be95d97478b3@redhat.com> Subject: Re: F_OFD_GETLK implemented wrong with CIFS protocol version 2.0+ MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Originating-IP: [10.64.54.105, 10.4.195.14] Thread-Topic: F_OFD_GETLK implemented wrong with CIFS protocol version 2.0+ Thread-Index: cyUI5gdk5jnau9xZqprq5PrbDI0PLw== X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.43]); Wed, 27 Jun 2018 01:11:41 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The problem is in fs/cifs/file.c:cifs_find_fid_lock_conflict since it is not aware of OFD locks and thus think there is a conflict. I have an initial patch that fixes the problem for the reproducer but need more time to understand if/what else might need fixin. ----- Original Message ----- > From: "Steve French" > To: labbott@redhat.com > Cc: "CIFS" , "samba-technical" , "LKML" > , "Adam Williamson" > Sent: Tuesday, 26 June, 2018 1:54:40 PM > Subject: Re: F_OFD_GETLK implemented wrong with CIFS protocol version 2.0+ > > We are taking a look at this - Ronnie had some ideas. Probably simply > not implemented - hopefully not too hard to fix. > On Mon, Jun 25, 2018 at 6:58 PM Laura Abbott wrote: > > > > Hi, > > > > A while back, someone reported a failure on Fedora when trying to boot > > a QEMU image off of a CIFS share. The issue was reduced down to a > > test case (https://bugzilla.redhat.com/show_bug.cgi?id=1484130#c8) > > > > # cat test-ofd-lock.c > > #define _GNU_SOURCE > > #include > > #include > > #include > > #include > > > > int main(int argc, char **argv) > > { > > int ret; > > int fd; > > struct flock fl = { > > .l_whence = SEEK_SET, > > .l_start = 0, > > .l_len = 0, > > .l_type = F_RDLCK, > > }; > > if (argc < 2) { > > fprintf(stderr, "Usage: %s \n", argv[0]); > > return 1; > > } > > fd = open(argv[1], O_RDWR); > > if (fd < 0) { > > perror("open"); > > return errno; > > } > > ret = fcntl(fd, F_OFD_SETLK, &fl); > > if (ret) { > > perror("setlk"); > > return errno; > > } > > fl.l_type = F_WRLCK; > > ret = fcntl(fd, F_OFD_GETLK, &fl); > > if (ret) { > > perror("getlk"); > > return errno; > > } > > if (fl.l_type != F_UNLCK) { > > fprintf(stderr, "get lock test failed\n"); > > return 1; > > } > > return 0; > > } > > [root@localhost ~]# make test-ofd-lock > > cc test-ofd-lock.c -o test-ofd-lock > > [root@localhost ~]# touch /tmp/test && ./test-ofd-lock /tmp/test > > [root@localhost ~]# echo $? > > 0 > > [root@localhost ~]# touch /mnt/test && ./test-ofd-lock /mnt/test > > get lock test failed > > [root@localhost ~]# mount | grep /mnt > > //192.168.31.1/tddownload on /mnt type cifs (rw,relatime,vers=3.0, > > cache=strict,username=admin,domain=,uid=0, > > noforceuid,gid=0,noforcegid,addr=192.168.31.1,file_mode=0755, > > dir_mode=0755,nounix,serverino,mapposix,rsize=1048576, > > wsize=1048576,echo_interval=60,actimeo=1,user=admin) > > > > > > As explained by one of the QEMU developers > > (https://bugzilla.redhat.com/show_bug.cgi?id=1484130#c37) > > > > ''' > > It is a kernel bug. The code snippet in comment 8 shows clearly that the > > kernel > > is doing the wrong thing, which cannot be fixed/worked around by QEMU. > > > > In man 2 fcntl: > > > > F_OFD_GETLK (struct flock *) > > On input to this call, lock describes an open file > > description lock > > we would like to place on the file. If the lock could be placed, > > fcntl() does not > > actually place it, but returns F_UNLCK in the l_type > > field of lock > > and leaves the other fields of the structure unchanged. If one or more > > incompatible > > locks would prevent this lock being placed, then details > > about one of > > these locks are returned via lock, as described above for F_GETLK. > > > > which is not the case with the new CIFS behaviour. > > '' > > > > You can read the full context at > > https://bugzilla.redhat.com/show_bug.cgi?id=1484130 > > > > Any suggestions? > > > > Thanks, > > Laura > > -- > > To unsubscribe from this list: send the line "unsubscribe linux-cifs" in > > the body of a message to majordomo@vger.kernel.org > > More majordomo info at http://vger.kernel.org/majordomo-info.html > > > > -- > Thanks, > > Steve > -- > To unsubscribe from this list: send the line "unsubscribe linux-cifs" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html >