Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 233895
b: refs/heads/master
c: e9e3d72
h: refs/heads/master
i:
  233893: a3474fa
  233891: 88988e4
  233887: 81ff3b1
v: v3
  • Loading branch information
Neil Horman authored and Linus Torvalds committed Mar 5, 2011
1 parent ea867d2 commit 7befe29
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 3 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 3256f80fbbc25bd2504bd564844c615227621e56
refs/heads/master: e9e3d724e2145f5039b423c290ce2b2c3d8f94bc
44 changes: 42 additions & 2 deletions trunk/fs/nfs/nfs4proc.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
#include <linux/sunrpc/bc_xprt.h>
#include <linux/xattr.h>
#include <linux/utsname.h>
#include <linux/mm.h>

#include "nfs4_fs.h"
#include "delegation.h"
Expand Down Expand Up @@ -3252,6 +3253,35 @@ static void buf_to_pages(const void *buf, size_t buflen,
}
}

static int buf_to_pages_noslab(const void *buf, size_t buflen,
struct page **pages, unsigned int *pgbase)
{
struct page *newpage, **spages;
int rc = 0;
size_t len;
spages = pages;

do {
len = min(PAGE_CACHE_SIZE, buflen);
newpage = alloc_page(GFP_KERNEL);

if (newpage == NULL)
goto unwind;
memcpy(page_address(newpage), buf, len);
buf += len;
buflen -= len;
*pages++ = newpage;
rc++;
} while (buflen != 0);

return rc;

unwind:
for(; rc > 0; rc--)
__free_page(spages[rc-1]);
return -ENOMEM;
}

struct nfs4_cached_acl {
int cached;
size_t len;
Expand Down Expand Up @@ -3420,13 +3450,23 @@ static int __nfs4_proc_set_acl(struct inode *inode, const void *buf, size_t bufl
.rpc_argp = &arg,
.rpc_resp = &res,
};
int ret;
int ret, i;

if (!nfs4_server_supports_acls(server))
return -EOPNOTSUPP;
i = buf_to_pages_noslab(buf, buflen, arg.acl_pages, &arg.acl_pgbase);
if (i < 0)
return i;
nfs_inode_return_delegation(inode);
buf_to_pages(buf, buflen, arg.acl_pages, &arg.acl_pgbase);
ret = nfs4_call_sync(server, &msg, &arg, &res, 1);

/*
* Free each page after tx, so the only ref left is
* held by the network stack
*/
for (; i > 0; i--)
put_page(pages[i-1]);

/*
* Acl update can result in inode attribute update.
* so mark the attribute cache invalid.
Expand Down

0 comments on commit 7befe29

Please sign in to comment.