From owner-svn-src-all@FreeBSD.ORG Thu Feb 26 12:33:17 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 99B21106575E; Thu, 26 Feb 2009 12:33:17 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 84A248FC27; Thu, 26 Feb 2009 12:33:17 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n1QCXHCU027780; Thu, 26 Feb 2009 12:33:17 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n1QCXHOE027779; Thu, 26 Feb 2009 12:33:17 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <200902261233.n1QCXHOE027779@svn.freebsd.org> From: Andriy Gapon Date: Thu, 26 Feb 2009 12:33:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r189069 - head/sys/fs/udf X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 26 Feb 2009 12:33:22 -0000 Author: avg Date: Thu Feb 26 12:33:17 2009 New Revision: 189069 URL: http://svn.freebsd.org/changeset/base/189069 Log: udf_map: return proper error code instead of leaking an internal one Incidentally this also allows for small files with data embedded into fentry to be mmap-ed. Approved by: jhb (mentor) Modified: head/sys/fs/udf/udf_vnops.c Modified: head/sys/fs/udf/udf_vnops.c ============================================================================== --- head/sys/fs/udf/udf_vnops.c Thu Feb 26 12:33:12 2009 (r189068) +++ head/sys/fs/udf/udf_vnops.c Thu Feb 26 12:33:17 2009 (r189069) @@ -1056,8 +1056,19 @@ udf_bmap(struct vop_bmap_args *a) if (a->a_runb) *a->a_runb = 0; - error = udf_bmap_internal(node, a->a_bn * node->udfmp->bsize, &lsector, - &max_size); + /* + * UDF_INVALID_BMAP means data embedded into fentry, this is an internal + * error that should not be propagated to calling code. + * Most obvious mapping for this error is EOPNOTSUPP as we can not truly + * translate block numbers in this case. + * Incidentally, this return code will make vnode pager to use VOP_READ + * to get data for mmap-ed pages and udf_read knows how to do the right + * thing for this kind of files. + */ + error = udf_bmap_internal(node, a->a_bn << node->udfmp->bshift, + &lsector, &max_size); + if (error == UDF_INVALID_BMAP) + return (EOPNOTSUPP); if (error) return (error);