Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 19 Mar 2009 14:07:27 +0000 (UTC)
From:      Andriy Gapon <avg@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org
Subject:   svn commit: r190049 - in stable/7/sys: . fs/udf
Message-ID:  <200903191407.n2JE7RvG063974@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: avg
Date: Thu Mar 19 14:07:27 2009
New Revision: 190049
URL: http://svn.freebsd.org/changeset/base/190049

Log:
  MFC 189069: udf_map: return proper error code instead of leaking an internal one
  
  Approved by:	jhb (mentor)

Modified:
  stable/7/sys/   (props changed)
  stable/7/sys/fs/udf/udf_vnops.c

Modified: stable/7/sys/fs/udf/udf_vnops.c
==============================================================================
--- stable/7/sys/fs/udf/udf_vnops.c	Thu Mar 19 14:04:59 2009	(r190048)
+++ stable/7/sys/fs/udf/udf_vnops.c	Thu Mar 19 14:07:27 2009	(r190049)
@@ -1039,8 +1039,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);
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200903191407.n2JE7RvG063974>