svn commit: r189069 - head/sys/fs/udf

Andriy Gapon avg at FreeBSD.org
Thu Feb 26 11:28:42 PST 2009


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);
 
_______________________________________________
svn-src-all at freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscribe at freebsd.org"


More information about the svn-src-head mailing list