Linux CIFS filesystem development
 help / color / mirror / Atom feed
From: David Howells <dhowells@redhat.com>
To: Suresh Jayaraman <sjayaraman@suse.de>
Cc: Steve French <smfrench@gmail.com>,
	linux-cachefs@redhat.com, linux-cifs <linux-cifs@vger.kernel.org>
Subject: Re: [PATCH] cifs: invalidate any mapped pages before turning cache off
Date: Tue, 14 Jun 2011 16:44:09 +0100	[thread overview]
Message-ID: <14229.1308066249@redhat.com> (raw)
In-Reply-To: <4DF778F6.3040704@suse.de>

Suresh Jayaraman <sjayaraman@suse.de> wrote:

> When disabling inode cookie, we were returning the cookie and setting
> cifsi->fscache to NULL but failed to invalidate any previously mapped
> pages. This resulted in "Bad page state" errors and manifested in other
> kind of errors when running fsstress. Fix it by invalidating mapped
> pages when we disable the inode cookie.
> 
> Also make cifs_fscache_disable_inode_cookie() return error if
> invalidate_inode_pages2() fails

I think I see what's going on: you have to 'hand back' all the page-in-use
marks before calling fscache_relinquish_cookie().  One way to do that is to
call invalidate_inode_pages2() or similar; the other is to iterate over all
the pages attached to your inode and call cifs_fscache_invalidate_page() on
every page.  Note that this may sleep to achieve its aim of getting rid of the
mark.

Let me have a go at whipping up a patch to do this.  It looks like it belongs
in fscache really as a helper function.

FS-Cache assumes that *you* know where all your pages are, and so it would be
redundant for it to keep its own list and thus keep extra memory around that
isn't strictly necessary.

Note also that:

	void cifs_fscache_set_inode_cookie(struct inode *inode, struct file *filp)
	{
		if ((filp->f_flags & O_ACCMODE) != O_RDONLY)
			cifs_fscache_disable_inode_cookie(inode);
		else
			cifs_fscache_enable_inode_cookie(inode);
	}

doesn't actually work right (and should be fixed in NFS too).  Imagine you
have a file open for read-only and you open it again for read-write or vice
versa.  This really needs a counter of writers.

David

      reply	other threads:[~2011-06-14 15:44 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-14 15:06 [PATCH] cifs: invalidate any mapped pages before turning cache off Suresh Jayaraman
2011-06-14 15:44 ` David Howells [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=14229.1308066249@redhat.com \
    --to=dhowells@redhat.com \
    --cc=linux-cachefs@redhat.com \
    --cc=linux-cifs@vger.kernel.org \
    --cc=sjayaraman@suse.de \
    --cc=smfrench@gmail.com \
    /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