From owner-svn-src-head@FreeBSD.ORG Tue Apr 28 09:11:48 2015 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 5183F4A0; Tue, 28 Apr 2015 09:11:48 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3FB091E97; Tue, 28 Apr 2015 09:11:48 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t3S9BmPm054741; Tue, 28 Apr 2015 09:11:48 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t3S9BmTh054740; Tue, 28 Apr 2015 09:11:48 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201504280911.t3S9BmTh054740@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Tue, 28 Apr 2015 09:11:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r282130 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Apr 2015 09:11:48 -0000 Author: avg Date: Tue Apr 28 09:11:47 2015 New Revision: 282130 URL: https://svnweb.freebsd.org/changeset/base/282130 Log: zfs_onexit_fd_hold: return EBADF even if devfs_get_cdevpriv gave ENOENT /dev/zfs always has per-open data, so when it is missing the file descriptor is for some other file. Returning ENOENT in this case is confusing as a variety of other conditions (like a missing dataset) may result in the same error. It's better to consistently return EBADF for any problems with the file descriptor. Note that zfs_onexit_fd_hold() is used with 'automatic cleanup fd' - when that fd is closed, typically because a process is terminated, some cleanup action is taken by ZFS driver. E.g. a temporary snapshot hold is released. Perhaps, it would even be worthwhile changing devfs_get_cdevpriv() to return EBADF if there is no associated data. Differential Revision: https://reviews.freebsd.org/D2370 Reviewed by: delphij, smh MFC after: 12 days Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_onexit.c Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_onexit.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_onexit.c Tue Apr 28 08:27:44 2015 (r282129) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_onexit.c Tue Apr 28 09:11:47 2015 (r282130) @@ -137,7 +137,7 @@ zfs_onexit_fd_hold(int fd, minor_t *mino *minorp = (minor_t)(uintptr_t)data; curthread->td_fpop = tmpfp; if (error != 0) - return (error); + return (SET_ERROR(EBADF)); return (zfs_onexit_minor_to_state(*minorp, &zo)); }