public inbox for linux-nfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Hans Kramer <hans.kramer-qWit8jRvyhVmR6Xm/wNWPw@public.gmane.org>
To: Chuck Lever <chuck.lever@oracle.com>
Cc: linux-nfs@vger.kernel.org
Subject: Re: Invalidating NFS attribute cache
Date: Thu, 09 Jul 2009 16:39:09 +0200	[thread overview]
Message-ID: <1247150349.7427.84.camel@cancun.hanskramer.com> (raw)
In-Reply-To: <5440D81E-BC29-4061-92B5-D750CEECFF62@oracle.com>

[-- Attachment #1: Type: text/plain, Size: 2020 bytes --]

Thanks Chuck,

I was not aware of this mount option.

I will try it.

Thanks!


On Thu, 2009-07-09 at 10:10 -0400, Chuck Lever wrote:
> On Jul 9, 2009, at 8:34 AM, Hans Kramer wrote:
> > Hi,
> >
> > For some silly reason I have an application that needs to poll for the
> > existence of a certain file on a NFS share.
> > (This is done from Sybase ASE ;-)
> >
> > Now I run into the issue of attribute caching. Turning of the  
> > attribute
> > cache with the mount option of -o noac easily solves all the issues.
> >
> > However, it would be nice if we could still use attribute caching and
> > force to invalidate on-demand the attribute cache.
> 
> Since you are only concerned with the existence of a file (and not its  
> mtime, say). have you considered the new directory cache mount option:  
> lookupcache=?
> 
> I see it's not mentioned in nfs(8) so you should probably look in  
> recent archives of this mailing list for information.
> 
> > After a lot of trying, the following solution seems to work for me  
> > now:
> > (pathname is the test file)
> >
> > #define _GNU_SOURCE
> >
> >    char *copy = strdup(pathname);
> >    char *path = dirname(copy);
> >
> >    int fd = open(path, O_DIRECTORY);
> >    if (fd >= 0)
> >        close(fd);
> >
> >    free(copy);
> >
> >    return access(pathname, F_OK);
> >
> > Just opening the parent directory with O_DIRECTORY seems to do the
> > trick.
> >
> > My questions: Is this hack going to work under every circumstance or
> > could it fail in the future with some update. Is there a ioctl call  
> > that
> > could the the same thing? That is invalidate the parent directory  
> > cache.
> > Or do I miss something completely ?-)
> >
> > Thanks in advance
> >
> > Hans
> >
> > --
> > To unsubscribe from this list: send the line "unsubscribe linux-nfs"  
> > in
> > the body of a message to majordomo@vger.kernel.org
> > More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 197 bytes --]

      reply	other threads:[~2009-07-09 14:39 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-09 12:34 Invalidating NFS attribute cache Hans Kramer
     [not found] ` <1247142894.7427.43.camel-6FgEqA8bTCrD1MxPaE+0Y3nhMCiq3JZZ@public.gmane.org>
2009-07-09 14:10   ` Chuck Lever
2009-07-09 14:39     ` Hans Kramer [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1247150349.7427.84.camel@cancun.hanskramer.com \
    --to=hans.kramer-qwit8jrvyhvmr6xm/wnwpw@public.gmane.org \
    --cc=chuck.lever@oracle.com \
    --cc=linux-nfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox