lkml.org 
[lkml]   [2010]   [Sep]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Date
    Subject[PATCH 03/10] ovl: use correct seek function for directories.
    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@suse.de>
    ---
    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;
    }



    \
     
     \ /
      Last update: 2010-09-06 02:55    [W:0.020 / U:39.820 seconds]
    ©2003-2017 Jasper Spaans. hosted at Digital OceanAdvertise on this site