Commit b291f1b1 authored by Trond Myklebust's avatar Trond Myklebust

NFSv4: Fix the acl cache size calculation

Currently, we do not take into account the size of the 16 byte
struct nfs4_cached_acl header, when deciding whether or not we should
cache the acl data.  Consequently, we will end up allocating an
8k buffer in order to fit a maximum size 4k acl.

This patch adjusts the calculation so that we limit the cache size
to 4k for the acl header+data.
Signed-off-by: default avatarTrond Myklebust <Trond.Myklebust@netapp.com>
parent 519d3959
...@@ -3737,9 +3737,10 @@ static inline ssize_t nfs4_read_cached_acl(struct inode *inode, char *buf, size_ ...@@ -3737,9 +3737,10 @@ static inline ssize_t nfs4_read_cached_acl(struct inode *inode, char *buf, size_
static void nfs4_write_cached_acl(struct inode *inode, struct page **pages, size_t pgbase, size_t acl_len) static void nfs4_write_cached_acl(struct inode *inode, struct page **pages, size_t pgbase, size_t acl_len)
{ {
struct nfs4_cached_acl *acl; struct nfs4_cached_acl *acl;
size_t buflen = sizeof(*acl) + acl_len;
if (pages && acl_len <= PAGE_SIZE) { if (pages && buflen <= PAGE_SIZE) {
acl = kmalloc(sizeof(*acl) + acl_len, GFP_KERNEL); acl = kmalloc(buflen, GFP_KERNEL);
if (acl == NULL) if (acl == NULL)
goto out; goto out;
acl->cached = 1; acl->cached = 1;
......
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