[PATCH 03/10] ovl: use correct seek function for directories.

From: NeilBrown
Date: Sun Sep 05 2010 - 20:51:37 EST


It is incorrect to call generic_llseek_file on a file from a different
filesystem. For that we must use the seek function that the
filesystem defines, which is called by vfs_llseek.

Also, we only want to seek the realfile when is_real is true.
Otherwise we just want to update our own f_pos pointer, so use
generic_llseek_file for that.

Signed-off-by: NeilBrown <neilb@xxxxxxx>
---
fs/overlayfs/overlayfs.c | 7 +++++--
1 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/fs/overlayfs/overlayfs.c b/fs/overlayfs/overlayfs.c
index 4e032e8..306de45 100644
--- a/fs/overlayfs/overlayfs.c
+++ b/fs/overlayfs/overlayfs.c
@@ -307,8 +307,11 @@ static loff_t ovl_dir_llseek(struct file *file, loff_t offset, int origin)
loff_t res;
struct ovl_dir_file *od = file->private_data;

- res = generic_file_llseek(od->realfile, offset, origin);
- file->f_pos = od->realfile->f_pos;
+ if (od->is_real) {
+ res = vfs_llseek(od->realfile, offset, origin);
+ file->f_pos = od->realfile->f_pos;
+ } else
+ res = generic_file_llseek(file, offset, origin);

return res;
}


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/