diff options
author | avg <avg@FreeBSD.org> | 2009-02-26 12:33:17 +0000 |
---|---|---|
committer | avg <avg@FreeBSD.org> | 2009-02-26 12:33:17 +0000 |
commit | e1be6e63ae9fe9745df160dcdddb756e7105a9e3 (patch) | |
tree | b0cea36472a5982ba85473e520354d3e8fd0cd77 /sys/fs | |
parent | 66df72ab44aeb22c0b0a299866db8ed39d1ecbb7 (diff) | |
download | FreeBSD-src-e1be6e63ae9fe9745df160dcdddb756e7105a9e3.zip FreeBSD-src-e1be6e63ae9fe9745df160dcdddb756e7105a9e3.tar.gz |
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)
Diffstat (limited to 'sys/fs')
-rw-r--r-- | sys/fs/udf/udf_vnops.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/sys/fs/udf/udf_vnops.c b/sys/fs/udf/udf_vnops.c index bde9215..d8da97e 100644 --- a/sys/fs/udf/udf_vnops.c +++ b/sys/fs/udf/udf_vnops.c @@ -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); |