Commit b84e06c5 authored by Chuck Lever's avatar Chuck Lever Committed by Trond Myklebust

NFS: Make nfs_llseek methods consistent

Clean up: Report the same debugging info in nfs_llseek_dir() and
nfs_llseek_file().
Signed-off-by: default avatarChuck Lever <chuck.lever@oracle.com>
Signed-off-by: default avatarTrond Myklebust <Trond.Myklebust@netapp.com>
parent 54917786
...@@ -603,7 +603,15 @@ static int nfs_readdir(struct file *filp, void *dirent, filldir_t filldir) ...@@ -603,7 +603,15 @@ static int nfs_readdir(struct file *filp, void *dirent, filldir_t filldir)
static loff_t nfs_llseek_dir(struct file *filp, loff_t offset, int origin) static loff_t nfs_llseek_dir(struct file *filp, loff_t offset, int origin)
{ {
mutex_lock(&filp->f_path.dentry->d_inode->i_mutex); struct dentry *dentry = filp->f_path.dentry;
struct inode *inode = dentry->d_inode;
dfprintk(VFS, "NFS: llseek dir(%s/%s, %lld, %d)\n",
dentry->d_parent->d_name.name,
dentry->d_name.name,
offset, origin);
mutex_lock(&inode->i_mutex);
switch (origin) { switch (origin) {
case 1: case 1:
offset += filp->f_pos; offset += filp->f_pos;
...@@ -619,7 +627,7 @@ static loff_t nfs_llseek_dir(struct file *filp, loff_t offset, int origin) ...@@ -619,7 +627,7 @@ static loff_t nfs_llseek_dir(struct file *filp, loff_t offset, int origin)
nfs_file_open_context(filp)->dir_cookie = 0; nfs_file_open_context(filp)->dir_cookie = 0;
} }
out: out:
mutex_unlock(&filp->f_path.dentry->d_inode->i_mutex); mutex_unlock(&inode->i_mutex);
return offset; return offset;
} }
......
...@@ -170,6 +170,11 @@ static int nfs_revalidate_file_size(struct inode *inode, struct file *filp) ...@@ -170,6 +170,11 @@ static int nfs_revalidate_file_size(struct inode *inode, struct file *filp)
static loff_t nfs_file_llseek(struct file *filp, loff_t offset, int origin) static loff_t nfs_file_llseek(struct file *filp, loff_t offset, int origin)
{ {
dfprintk(VFS, "NFS: llseek file(%s/%s, %lld, %d)\n",
filp->f_path.dentry->d_parent->d_name.name,
filp->f_path.dentry->d_name.name,
offset, origin);
/* origin == SEEK_END => we must revalidate the cached file length */ /* origin == SEEK_END => we must revalidate the cached file length */
if (origin == SEEK_END) { if (origin == SEEK_END) {
struct inode *inode = filp->f_mapping->host; struct inode *inode = filp->f_mapping->host;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment