From owner-freebsd-hackers@freebsd.org Tue Dec 8 09:35:33 2015 Return-Path: Delivered-To: freebsd-hackers@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C437A9D4E17 for ; Tue, 8 Dec 2015 09:35:33 +0000 (UTC) (envelope-from sobomax@sippysoft.com) Received: from mail-wm0-x232.google.com (mail-wm0-x232.google.com [IPv6:2a00:1450:400c:c09::232]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 809091D80 for ; Tue, 8 Dec 2015 09:35:33 +0000 (UTC) (envelope-from sobomax@sippysoft.com) Received: by wmec201 with SMTP id c201so203804838wme.0 for ; Tue, 08 Dec 2015 01:35:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sippysoft-com.20150623.gappssmtp.com; s=20150623; h=mime-version:sender:date:message-id:subject:from:to:cc:content-type; bh=uWVUNsO9fQOhywnJRteV1Fp3z0rXOKPNynYP70LqNtA=; b=DnugOvXbLv2+3nDiUIMvtFWn7gNg9mac1B+4qwCzCYbyPQdRHlTlqZnjr0smwMN4jm IUqiUb0yb82P700WiH5OTaZU1e0Br0ZJCld/caWWKEUB9R+UHx2ZEVEv4aoTw7xk6Ttp 5QbLIDBJ/tDxsE3RKLsTa+h7q77HtzYYOotxzhaoSvU+EXqKshdPnYEv06l4JBFMub41 NwDb7Y4FVRsNpTb1hGuK2ARXnNYCDMm9+UA7rqfwUKPRPpnaptx4lzVot3jBMNFSwzxm T8s7HmED9m9/+cqFwAufjY/uaZM9lirko6sqsGDgTD7GazSNWNNZ/Lxd4zI1mbRjJW7E q9Wg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:sender:date:message-id:subject:from :to:cc:content-type; bh=uWVUNsO9fQOhywnJRteV1Fp3z0rXOKPNynYP70LqNtA=; b=H2+XI9Fn6DWjeiXl/S9zTJ4Wcbfqj5TMz/WyPX9z8kuEHJGN1FmJQfds6uypHwsy0A DQ7hjGn3c0BHZ8d7fUXl+/6TDVnkF0Kl4PW6CR/oRCbUhdZwi6jC6Qg+2tCLq5gawKn9 4kBkBemjCdUhMWqwbnmNZxLwiZksE53X5ePQSExONANtC0QkH1bulU0oN+YKC0OH3h00 2+rvUUqCPfdJkSAge7VFDhgyiaDoDi6L/zyWbn2vX1aAO/pURFwJqB8s+lU/9PO9mBJ2 hHlnRmIv9XMLyu95OcPkPUyAiCaXvyleaR99xnSuzfua69m4yc5BhbPSsq5YMy1Xr41f pZTw== X-Gm-Message-State: ALoCoQn7xNbEX/Tfl0oPKkrhIXhIRK54j2G4FEaLPxUH7VFyELjaqx5RMbg/QvPY0S7W7F9IOpPLV0R8LIWT5vAFZ3bMKlgetJn10gmJY2q8Swh27KqtsDY= MIME-Version: 1.0 X-Received: by 10.194.172.2 with SMTP id ay2mr2557252wjc.137.1449567331781; Tue, 08 Dec 2015 01:35:31 -0800 (PST) Sender: sobomax@sippysoft.com Received: by 10.27.39.135 with HTTP; Tue, 8 Dec 2015 01:35:31 -0800 (PST) Date: Tue, 8 Dec 2015 01:35:31 -0800 X-Google-Sender-Auth: EqyANEPP8GE7pEsueXqy4Kn3ZZM Message-ID: Subject: posix_fallocate(2) && posix_fadvise(2) are somewhat broken From: Maxim Sobolev To: freebsd-current@freebsd.org, freebsd-hackers@freebsd.org Cc: kib@freebsd.org, Kirk McKusick Content-Type: multipart/mixed; boundary=089e013c6214e43b4c05265fb14e X-Content-Filtered-By: Mailman/MimeDel 2.1.20 X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Dec 2015 09:35:34 -0000 --089e013c6214e43b4c05265fb14e Content-Type: text/plain; charset=UTF-8 Hi, while working on some unrelated feature I've noticed that at least those two system calls are not returning proper value (-1) on error. Instead actual errno value is returned from the syscall verbatim, i.e. posix_fadvise() returns 22 on EINVAL. Attached patch fixes that problem, however I am not sure if I need to assign td->td_retval[0] at all, those two operations by design never return anything but -1 on error and 0 on success. Can someone comment on this? Thanks! --089e013c6214e43b4c05265fb14e Content-Type: text/plain; charset=US-ASCII; name="vfs_syscalls.diff" Content-Disposition: attachment; filename="vfs_syscalls.diff" Content-Transfer-Encoding: base64 X-Attachment-Id: f_ihx6qlod0 ZGlmZiAtLWdpdCBhL3N5cy9rZXJuL3Zmc19zeXNjYWxscy5jIGIvc3lzL2tlcm4vdmZzX3N5c2Nh bGxzLmMKaW5kZXggZTY3NWIwOS4uYmRiMTYzOSAxMDA2NDQKLS0tIGEvc3lzL2tlcm4vdmZzX3N5 c2NhbGxzLmMKKysrIGIvc3lzL2tlcm4vdmZzX3N5c2NhbGxzLmMKQEAgLTQ1MjgsNyArNDUyOCw3 IEBAIHN5c19wb3NpeF9mYWxsb2NhdGUoc3RydWN0IHRocmVhZCAqdGQsIHN0cnVjdCBwb3NpeF9m YWxsb2NhdGVfYXJncyAqdWFwKQogCiAJdGQtPnRkX3JldHZhbFswXSA9IGtlcm5fcG9zaXhfZmFs bG9jYXRlKHRkLCB1YXAtPmZkLCB1YXAtPm9mZnNldCwKIAkgICAgdWFwLT5sZW4pOwotCXJldHVy biAoMCk7CisJcmV0dXJuICh0ZC0+dGRfcmV0dmFsWzBdKTsKIH0KIAogLyoKQEAgLTQ2NjUsNSAr NDY2NSw1IEBAIHN5c19wb3NpeF9mYWR2aXNlKHN0cnVjdCB0aHJlYWQgKnRkLCBzdHJ1Y3QgcG9z aXhfZmFkdmlzZV9hcmdzICp1YXApCiAKIAl0ZC0+dGRfcmV0dmFsWzBdID0ga2Vybl9wb3NpeF9m YWR2aXNlKHRkLCB1YXAtPmZkLCB1YXAtPm9mZnNldCwKIAkgICAgdWFwLT5sZW4sIHVhcC0+YWR2 aWNlKTsKLQlyZXR1cm4gKDApOworCXJldHVybiAodGQtPnRkX3JldHZhbFswXSk7CiB9Cg== --089e013c6214e43b4c05265fb14e--