diff mbox

[2/4] cifs: new helper function: cifs_revalidate_mapping

Message ID 1396288209-27328-3-git-send-email-jlayton@redhat.com (mailing list archive)
State New, archived
Headers show

Commit Message

Jeff Layton March 31, 2014, 5:50 p.m. UTC
Consolidate a bit of code. In a later patch we'll expand this to fix
some races.

Signed-off-by: Jeff Layton <jlayton@redhat.com>
---
 fs/cifs/cifsfs.h |  1 +
 fs/cifs/inode.c  | 16 ++++++++++------
 2 files changed, 11 insertions(+), 6 deletions(-)

Comments

Steve French April 25, 2014, 3:53 a.m. UTC | #1
The extra semicolon in the following looks wrong

On Mon, Mar 31, 2014 at 12:50 PM, Jeff Layton <jlayton@redhat.com> wrote:
> Consolidate a bit of code. In a later patch we'll expand this to fix
> some races.
>
> Signed-off-by: Jeff Layton <jlayton@redhat.com>
> ---
>  fs/cifs/cifsfs.h |  1 +
>  fs/cifs/inode.c  | 16 ++++++++++------
>  2 files changed, 11 insertions(+), 6 deletions(-)
>
> diff --git a/fs/cifs/cifsfs.h b/fs/cifs/cifsfs.h
> index 26a754f49ba1..40d5a4df1e38 100644
> --- a/fs/cifs/cifsfs.h
> +++ b/fs/cifs/cifsfs.h
> @@ -67,6 +67,7 @@ extern int cifs_revalidate_dentry_attr(struct dentry *);
>  extern int cifs_revalidate_file(struct file *filp);
>  extern int cifs_revalidate_dentry(struct dentry *);
>  extern int cifs_invalidate_mapping(struct inode *inode);
> +extern int cifs_revalidate_mapping(struct inode *inode);
>  extern int cifs_getattr(struct vfsmount *, struct dentry *, struct kstat *);
>  extern int cifs_setattr(struct dentry *, struct iattr *);
>
> diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c
> index 3e9d8ba21f5c..39b76bac196d 100644
> --- a/fs/cifs/inode.c
> +++ b/fs/cifs/inode.c
> @@ -1779,6 +1779,14 @@ cifs_invalidate_mapping(struct inode *inode)
>         return rc;
>  }
>
> +int
> +cifs_revalidate_mapping(struct inode *inode)
> +{
> +       if (test_bit(CIFS_INODE_INVALID_MAPPING, &CIFS_I(inode)->flags));
> +               return cifs_invalidate_mapping(inode);
> +       return 0;
> +}
> +
>  int cifs_revalidate_file_attr(struct file *filp)
>  {
>         int rc = 0;
> @@ -1845,9 +1853,7 @@ int cifs_revalidate_file(struct file *filp)
>         if (rc)
>                 return rc;
>
> -       if (test_bit(CIFS_INO_INVALID_MAPPING, &CIFS_I(inode)->flags));
> -               rc = cifs_invalidate_mapping(inode);
> -       return rc;
> +       return cifs_revalidate_mapping(inode);
>  }
>
>  /* revalidate a dentry's inode attributes */
> @@ -1860,9 +1866,7 @@ int cifs_revalidate_dentry(struct dentry *dentry)
>         if (rc)
>                 return rc;
>
> -       if (test_bit(CIFS_INO_INVALID_MAPPING, &CIFS_I(inode)->flags));
> -               rc = cifs_invalidate_mapping(inode);
> -       return rc;
> +       return cifs_revalidate_mapping(inode);
>  }
>
>  int cifs_getattr(struct vfsmount *mnt, struct dentry *dentry,
> --
> 1.9.0
>
Jeff Layton April 25, 2014, 10:34 a.m. UTC | #2
On Thu, 24 Apr 2014 22:45:46 -0500
Steve French <smfrench@gmail.com> wrote:

> The extra semicolon in the following looks wrong
> 
> +       if (test_bit(CIFS_INODE_INVALID_MAPPING, &CIFS_I(inode)->flags));
> +               return cifs_invalidate_mapping(inode);
> 
> 

Oh my, yes. Good catch. I'll fix and resend -- might be a few days
before I can get to it though.

> On Mon, Mar 31, 2014 at 12:50 PM, Jeff Layton <jlayton@redhat.com> wrote:
> 
> > Consolidate a bit of code. In a later patch we'll expand this to fix
> > some races.
> >
> > Signed-off-by: Jeff Layton <jlayton@redhat.com>
> > ---
> >  fs/cifs/cifsfs.h |  1 +
> >  fs/cifs/inode.c  | 16 ++++++++++------
> >  2 files changed, 11 insertions(+), 6 deletions(-)
> >
> > diff --git a/fs/cifs/cifsfs.h b/fs/cifs/cifsfs.h
> > index 26a754f49ba1..40d5a4df1e38 100644
> > --- a/fs/cifs/cifsfs.h
> > +++ b/fs/cifs/cifsfs.h
> > @@ -67,6 +67,7 @@ extern int cifs_revalidate_dentry_attr(struct dentry *);
> >  extern int cifs_revalidate_file(struct file *filp);
> >  extern int cifs_revalidate_dentry(struct dentry *);
> >  extern int cifs_invalidate_mapping(struct inode *inode);
> > +extern int cifs_revalidate_mapping(struct inode *inode);
> >  extern int cifs_getattr(struct vfsmount *, struct dentry *, struct kstat
> > *);
> >  extern int cifs_setattr(struct dentry *, struct iattr *);
> >
> > diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c
> > index 3e9d8ba21f5c..39b76bac196d 100644
> > --- a/fs/cifs/inode.c
> > +++ b/fs/cifs/inode.c
> > @@ -1779,6 +1779,14 @@ cifs_invalidate_mapping(struct inode *inode)
> >         return rc;
> >  }
> >
> > +int
> > +cifs_revalidate_mapping(struct inode *inode)
> > +{
> > +       if (test_bit(CIFS_INODE_INVALID_MAPPING, &CIFS_I(inode)->flags));
> > +               return cifs_invalidate_mapping(inode);
> > +       return 0;
> > +}
> > +
> >  int cifs_revalidate_file_attr(struct file *filp)
> >  {
> >         int rc = 0;
> > @@ -1845,9 +1853,7 @@ int cifs_revalidate_file(struct file *filp)
> >         if (rc)
> >                 return rc;
> >
> > -       if (test_bit(CIFS_INO_INVALID_MAPPING, &CIFS_I(inode)->flags));
> > -               rc = cifs_invalidate_mapping(inode);
> > -       return rc;
> > +       return cifs_revalidate_mapping(inode);
> >  }
> >
> >  /* revalidate a dentry's inode attributes */
> > @@ -1860,9 +1866,7 @@ int cifs_revalidate_dentry(struct dentry *dentry)
> >         if (rc)
> >                 return rc;
> >
> > -       if (test_bit(CIFS_INO_INVALID_MAPPING, &CIFS_I(inode)->flags));
> > -               rc = cifs_invalidate_mapping(inode);
> > -       return rc;
> > +       return cifs_revalidate_mapping(inode);
> >  }
> >
> >  int cifs_getattr(struct vfsmount *mnt, struct dentry *dentry,
> > --
> > 1.9.0
> >
> >
> 
>
diff mbox

Patch

diff --git a/fs/cifs/cifsfs.h b/fs/cifs/cifsfs.h
index 26a754f49ba1..40d5a4df1e38 100644
--- a/fs/cifs/cifsfs.h
+++ b/fs/cifs/cifsfs.h
@@ -67,6 +67,7 @@  extern int cifs_revalidate_dentry_attr(struct dentry *);
 extern int cifs_revalidate_file(struct file *filp);
 extern int cifs_revalidate_dentry(struct dentry *);
 extern int cifs_invalidate_mapping(struct inode *inode);
+extern int cifs_revalidate_mapping(struct inode *inode);
 extern int cifs_getattr(struct vfsmount *, struct dentry *, struct kstat *);
 extern int cifs_setattr(struct dentry *, struct iattr *);
 
diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c
index 3e9d8ba21f5c..39b76bac196d 100644
--- a/fs/cifs/inode.c
+++ b/fs/cifs/inode.c
@@ -1779,6 +1779,14 @@  cifs_invalidate_mapping(struct inode *inode)
 	return rc;
 }
 
+int
+cifs_revalidate_mapping(struct inode *inode)
+{
+	if (test_bit(CIFS_INODE_INVALID_MAPPING, &CIFS_I(inode)->flags));
+		return cifs_invalidate_mapping(inode);
+	return 0;
+}
+
 int cifs_revalidate_file_attr(struct file *filp)
 {
 	int rc = 0;
@@ -1845,9 +1853,7 @@  int cifs_revalidate_file(struct file *filp)
 	if (rc)
 		return rc;
 
-	if (test_bit(CIFS_INO_INVALID_MAPPING, &CIFS_I(inode)->flags));
-		rc = cifs_invalidate_mapping(inode);
-	return rc;
+	return cifs_revalidate_mapping(inode);
 }
 
 /* revalidate a dentry's inode attributes */
@@ -1860,9 +1866,7 @@  int cifs_revalidate_dentry(struct dentry *dentry)
 	if (rc)
 		return rc;
 
-	if (test_bit(CIFS_INO_INVALID_MAPPING, &CIFS_I(inode)->flags));
-		rc = cifs_invalidate_mapping(inode);
-	return rc;
+	return cifs_revalidate_mapping(inode);
 }
 
 int cifs_getattr(struct vfsmount *mnt, struct dentry *dentry,