lkml.org 
[lkml]   [2007]   [Oct]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 14/52] CRED: Provide a writeback credentials record
Date
Provide a set of credentials specifically for the writeback functions.  Since
writeback may well occur in some other process context than the original write
into the pagecache, the current process's credentials are not applicable, and
so there are used instead.

If writeback needs to know the credentials, then those credentials should be
cached by prepare_write(), page_mkwrite() or similar. Filesystems such as NFS
and AFS need to do this as they need to communicate to a remote store the
appropriate security details under which the write should be made.
Filesystems such as Ext3 should perform allocation and reservation checks
before letting the write to the pagecache occur.

Signed-off-by: David Howells <dhowells@redhat.com>
---

fs/buffer.c | 2 +-
fs/mpage.c | 2 +-
include/linux/cred.h | 1 +
3 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/fs/buffer.c b/fs/buffer.c
index bb6ab45..0c8444a 100644
--- a/fs/buffer.c
+++ b/fs/buffer.c
@@ -1599,7 +1599,7 @@ EXPORT_SYMBOL(unmap_underlying_metadata);
static int __block_write_full_page(struct inode *inode, struct page *page,
get_block_t *get_block, struct writeback_control *wbc)
{
- struct cred *cred = current->cred;
+ struct cred *cred = &writeback_cred;
int err;
sector_t block;
sector_t last_block;
diff --git a/fs/mpage.c b/fs/mpage.c
index af97410..c04672d 100644
--- a/fs/mpage.c
+++ b/fs/mpage.c
@@ -457,7 +457,7 @@ struct mpage_data {
static int __mpage_writepage(struct page *page, struct writeback_control *wbc,
void *data)
{
- struct cred *cred = current->cred;
+ struct cred *cred = &writeback_cred;
struct mpage_data *mpd = data;
struct bio *bio = mpd->bio;
struct address_space *mapping = page->mapping;
diff --git a/include/linux/cred.h b/include/linux/cred.h
index 6ec0132..46f4a64 100644
--- a/include/linux/cred.h
+++ b/include/linux/cred.h
@@ -29,6 +29,7 @@ struct cred {
};

extern struct cred init_cred;
+#define writeback_cred init_cred

struct inode;

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2007-10-12 18:15    [W:0.230 / U:3.020 seconds]
©2003-2017 Jasper Spaans. hosted at Digital OceanAdvertise on this site