All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Howells <dhowells@redhat.com>
To: akpm@osdl.org
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH] CacheFiles: Handle ENOSPC on create/mkdir better
Date: Thu, 31 Aug 2006 13:42:49 +0100	[thread overview]
Message-ID: <15165.1157028169@warthog.cambridge.redhat.com> (raw)


Handle ENOSPC on create/mkdir calls to the backing filesystem better.  Rather
than returning it to FS-Cache or FS-Cache returning it to the netfs, it is
converted into ENOBUFS.

This can be reproduced by setting up a very small cache, for example with:

	dd if=/dev/zero of=/root/fakedisc bs=10240 count=1024
	mke2fs -j /root/fakedisc 
	tune2fs -o user_xattr /root/fakedisc 
	mount -o loop /root/fakedisc /var/fscache/
	cachefilesd

And then running a "find" over a few thousand NFS files on an NFS share that's
mounted with "-o fsc".  This will eventually run the cache out of free inodes,
and ENOSPC will be returned by Ext3, yielding a lot of these messages in the
kernel log:

	FS-Cache: error from cache: -28

David
---

 fs/cachefiles/cf-namei.c |    7 ++++++-
 fs/fscache/cookie.c      |    5 ++++-
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/fs/cachefiles/cf-namei.c b/fs/cachefiles/cf-namei.c
index 20db88a..202b89b 100644
--- a/fs/cachefiles/cf-namei.c
+++ b/fs/cachefiles/cf-namei.c
@@ -501,11 +501,13 @@ lookup_again:
 	return 0;
 
 create_error:
+	_debug("create error %d", ret);
 	if (ret == -EIO)
 		cachefiles_io_error(cache, "create/mkdir failed");
 	goto error;
 
 check_error:
+	_debug("check error %d", ret);
 	write_lock(&cache->active_lock);
 	rb_erase(&object->active_node, &cache->active_nodes);
 	write_unlock(&cache->active_lock);
@@ -538,7 +540,10 @@ error_out:
 	current->fsuid = fsuid;
 	current->fsgid = fsgid;
 
-	_leave(" = ret");
+	if (ret == -ENOSPC)
+		ret = -ENOBUFS;
+
+	_leave(" = error %d", -ret);
 	return ret;
 }
 
diff --git a/fs/fscache/cookie.c b/fs/fscache/cookie.c
index 9a6ac8b..8528eb7 100644
--- a/fs/fscache/cookie.c
+++ b/fs/fscache/cookie.c
@@ -750,7 +750,10 @@ no_cache:
 	ret = -ENOMEDIUM;
 	goto error_cleanup;
 error:
-	printk(KERN_ERR "FS-Cache: error from cache: %d\n", ret);
+	if (ret != -ENOBUFS) {
+		printk(KERN_ERR "FS-Cache: error from cache: %d\n", ret);
+		ret = -ENOBUFS;
+	}
 error_cleanup:
 	if (cookie) {
 		up_write(&cookie->sem);

             reply	other threads:[~2006-08-31 12:43 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-08-31 12:42 David Howells [this message]
2006-08-31 12:47 ` [PATCH] CacheFiles: Handle ENOSPC on create/mkdir better David Howells

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=15165.1157028169@warthog.cambridge.redhat.com \
    --to=dhowells@redhat.com \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.