From owner-freebsd-current@freebsd.org Sat Aug 17 03:39:18 2019 Return-Path: Delivered-To: freebsd-current@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 29309B9E93 for ; Sat, 17 Aug 2019 03:39:18 +0000 (UTC) (envelope-from rmacklem@uoguelph.ca) Received: from CAN01-QB1-obe.outbound.protection.outlook.com (mail-eopbgr660082.outbound.protection.outlook.com [40.107.66.82]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (Client CN "mail.protection.outlook.com", Issuer "GlobalSign Organization Validation CA - SHA256 - G3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 469Qsc74Qfz3Qtj; Sat, 17 Aug 2019 03:39:16 +0000 (UTC) (envelope-from rmacklem@uoguelph.ca) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Puh3atZgbGbwJ0+KOhoJaAbhcHv8rYHawXy9cjtdpHAfLLkCJ1HAdbaKUA8kpKHuEVzZk+GkEI2r2/iJljupkPo+6NoLaOFSKAO2Co+OG/2CXgBk0cyvL2D5NDnB0tJvfpY9zYQjusx2SsbsfV0E1KkeQBaozEPYSQjNs8SiRvl5gYb0MEQ3LNh6K9EhxcmbCxop2hQLsHbvDK4KxX5LWyIOBSk4VQFCi0EjDB9dV2bRKndqCaYJOHr3Olx/EuSrGfAYV9wMWA3bKzGPDryVYh3nXv/OTNGFB7ZC5+Gvg/YFmuBqJOfOnLcc4LRvTp3aBRr+R/thIr7Thmh7sz7acQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=2J7fudKVWyAZltsZQBzY5SggcWCnVbI+NWFsPeD5Olo=; b=d0i0N2v+CmyspqVpZvCuWfYCx+JE/uul31hoHukw62rAR6zK6FD0X5jfxAtMhPTQJVE2jOj23bUii2bzEFavHrvzwjbtuzGw7XNVGI94jUMd3FbzcmebzBbspozyI8QMBvM01e+Y7eZPxtYwckoArOBDhFufjsnPvjsaAlP82UZExQSUiRDqDiNCqU+gIurBNQbIV2hyYUYYLb+85hK5tQW14pYvcw0JOUUs5jQTZaDSzCMwod4nyRS8CByaA38+OXppnfpBSj9fh9zQvNXPNXJY9gGMzm6NlDzlp8aqn6DeihzaobHu/2C2DKkFNS10+EGLAysM3x8GdavQXefXpA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=uoguelph.ca; dmarc=pass action=none header.from=uoguelph.ca; dkim=pass header.d=uoguelph.ca; arc=none Received: from YTBPR01MB3616.CANPRD01.PROD.OUTLOOK.COM (10.255.12.82) by YTBPR01MB2544.CANPRD01.PROD.OUTLOOK.COM (10.255.46.16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2178.16; Sat, 17 Aug 2019 03:39:14 +0000 Received: from YTBPR01MB3616.CANPRD01.PROD.OUTLOOK.COM ([fe80::fc05:2310:90ce:16e]) by YTBPR01MB3616.CANPRD01.PROD.OUTLOOK.COM ([fe80::fc05:2310:90ce:16e%6]) with mapi id 15.20.2178.016; Sat, 17 Aug 2019 03:39:14 +0000 From: Rick Macklem To: Ian Lepore , Alan Somers CC: "gljennjohn@gmail.com" , "freebsd-current@FreeBSD.org" Subject: Re: RFC: should lseek(SEEK_DATA/SEEK_HOLE) return ENOTTY? Thread-Topic: RFC: should lseek(SEEK_DATA/SEEK_HOLE) return ENOTTY? Thread-Index: AQHVT+jQ5wsNrJT2jUSYLr8e3O7szab1hhuAgACEJgCAAARxAIAAHhmAgAiMaxs= Date: Sat, 17 Aug 2019 03:39:14 +0000 Message-ID: References: <20190811090405.50cc49b1@ernst.home> , In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 978b1049-e5f9-4329-2207-08d722c479dc x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600148)(711020)(4605104)(1401327)(2017052603328)(7193020); SRVR:YTBPR01MB2544; x-ms-traffictypediagnostic: YTBPR01MB2544: x-ms-exchange-purlcount: 2 x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:2887; x-forefront-prvs: 0132C558ED x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(346002)(366004)(376002)(136003)(396003)(39860400002)(199004)(189003)(55016002)(53546011)(186003)(6246003)(966005)(9686003)(71190400001)(74316002)(5660300002)(52536014)(71200400001)(446003)(11346002)(102836004)(256004)(66476007)(229853002)(7696005)(99286004)(4326008)(8676002)(6506007)(53936002)(33656002)(81156014)(81166006)(76176011)(66946007)(66446008)(64756008)(66556008)(6306002)(6436002)(46003)(25786009)(2906002)(86362001)(8936002)(54906003)(786003)(316002)(110136005)(14454004)(76116006)(486006)(305945005)(478600001)(476003); DIR:OUT; SFP:1101; SCL:1; SRVR:YTBPR01MB2544; H:YTBPR01MB3616.CANPRD01.PROD.OUTLOOK.COM; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; received-spf: None (protection.outlook.com: uoguelph.ca does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: oGsM1Xj0WSf+Q01xJbN5Xe4beadQZ5hRstVj+8G7uE/ex3U6ubwfmLDkbQVkvazBu3PzfII82ALU8+o2XN+A2QYdJGBDru6kxD2LuHBNdnWRjBzjtD7eTP4FloLiAcosDDJqRCaIS41Kpug6tOppJ1oa+vKRbbx31V8F7QU/0kfDH1adggoQAF2Pe/hvW/lgc2Ttvw0Xfmrz/FOAqOdqp9hTLnJH6ajPkmPEeIWRBiwnBTEPQsKI33b+kAPLZsefbvVPkBYlWUm2o72Dje8UHo6Hf79c+LX8HSR27cUs/molo8OZUYUNVmbMuGY6vN+5VpMBDNL78a8ZLV3n5Qhhr/BXUBeY4ojg2SrlnwZBqNMz0d2+DsMK23Dz14jCtZItx5yHhVXwShzhQlfqbPrnE/vjRP6/b7EFLAWnEhoKHL0= x-ms-exchange-transport-forked: True Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: uoguelph.ca X-MS-Exchange-CrossTenant-Network-Message-Id: 978b1049-e5f9-4329-2207-08d722c479dc X-MS-Exchange-CrossTenant-originalarrivaltime: 17 Aug 2019 03:39:14.8579 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: be62a12b-2cad-49a1-a5fa-85f4f3156a7d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: AmUK/bY26s314sWQvaBL5PW6d+0cC8qHxoKxpy6GHYMCLNdYcKfeoiGIzGi4pLlzSJNVbOYEwk4h51LlW4UoTw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: YTBPR01MB2544 X-Rspamd-Queue-Id: 469Qsc74Qfz3Qtj X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=pass (mx1.freebsd.org: domain of rmacklem@uoguelph.ca designates 40.107.66.82 as permitted sender) smtp.mailfrom=rmacklem@uoguelph.ca X-Spamd-Result: default: False [-4.39 / 15.00]; MIME_TRACE(0.00)[0:+]; TO_DN_EQ_ADDR_SOME(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; R_SPF_ALLOW(-0.20)[+ip4:40.107.0.0/16]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.10)[text/plain]; RCVD_TLS_LAST(0.00)[]; DMARC_NA(0.00)[uoguelph.ca]; TO_DN_SOME(0.00)[]; RCVD_COUNT_THREE(0.00)[3]; TO_MATCH_ENVRCPT_SOME(0.00)[]; NEURAL_HAM_SHORT(-0.94)[-0.940,0]; RCVD_IN_DNSWL_NONE(0.00)[82.66.107.40.list.dnswl.org : 127.0.3.0]; IP_SCORE(-1.15)[ipnet: 40.64.0.0/10(-3.39), asn: 8075(-2.30), country: US(-0.05)]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; SUBJECT_ENDS_QUESTION(1.00)[]; ASN(0.00)[asn:8075, ipnet:40.64.0.0/10, country:US]; ARC_ALLOW(-1.00)[i=1]; FREEMAIL_CC(0.00)[gmail.com] X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 17 Aug 2019 03:39:18 -0000 Ian Lepore wrote: >On Sun, 2019-08-11 at 09:12 -0600, Alan Somers wrote: >> On Sun, Aug 11, 2019 at 8:57 AM Ian Lepore wrote: >> > >> > On Sun, 2019-08-11 at 09:04 +0200, Gary Jennejohn wrote: >> > > On Sun, 11 Aug 2019 02:03:10 +0000 >> > > Rick Macklem wrote: >> > > >> > > > Hi, >> > > > >> > > > I've noticed that, if you do a lseek(SEEK_DATA/SEEK_HOLE) on a >> > > > file >> > > > that >> > > > resides in a file system that does not support holes, ENOTTY is >> > > > returned. >> > > > >> > > > This error isn't listed for lseek() and seems a liitle weird. >> > > > >> > > >> > > ENOTTY is the standard error return for an unimplemented >> > > ioctl(2), >> > > and SEEK_HOLE ultimately becomes a call to fo_ioctl(). >> > > >> > > > I can see a couple of alternatives to this: >> > > > 1 - Return a different error. Maybe ENXIO? >> > > > or >> > > > 2 - Have lseek() do the trivial implementation when the >> > > > VOP_IOCTL() >> > > > fails. >> > > > - For SEEK_DATA, just return the offset given as argument >> > > > and >> > > > for SEEK_HOLE >> > > > return the file's size as the offset. >> > > > >> > > > What do others think? rick >> > > > ps: The man page should be updated, whatever is done w.r.t. >> > > > this. >> > > > >> > > >> > > I also vote for option 2 >> > > >> > >> > If SEEK_DATA and SEEK_HOLE don't return the standard "ioctl not >> > supported" error code and return a fake result, how are you >> > supposed to >> > determine at runtime whether SEEK_HOLE is supported or not? >> > >> > -- Ian >> >> pathconf(2) will tell you. >> > >Ahh, I wasn't aware of that. > >For option 2, lseek() has to not just return the info, but must also >actually set the file position accordingly, and has to treat offset >=3D >filesize as an error. I have put a patch for this at https://reviews.freebsd.org/D21299 I listed markj@ as a reviewer, but anyone is welcome to review it, if they'= d like. Since vn_bmap_seekhole() can return ENOTTY, the above patch follows that convention as well. I also have a trivial patch to map errnos not specified for lseek() to EINV= AL. https://reviews.freebsd.org/D21300. Ditto above w.r.t. to reviewing it. rick