FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Ubuntu > Ubuntu Kernel Team

 
 
LinkBack Thread Tools
 
Old 07-07-2008, 11:17 PM
Kees Cook
 
Default aufs patches OriginalAuthor: Jeff Mahoney

Update Ubuntu AUFS tree for AppArmor VFS changes.

Signed-off-by: Jeff Mahoney <jeffm@suse.com>
Signed-off-by: John Johansen <jjohansen@suse.de>
Signed-off-by: Kees Cook <kees.cook@canonical.com>
---
ubuntu/aufs/dir.c | 1 +
ubuntu/aufs/f_op.c | 1 +
ubuntu/aufs/i_op.c | 27 +++++++++++++++------------
ubuntu/aufs/inode.h | 1 +
ubuntu/aufs/misc.c | 5 ++---
ubuntu/aufs/vfsub.c | 27 +++++++++++++++++----------
ubuntu/aufs/vfsub.h | 2 ++
7 files changed, 39 insertions(+), 25 deletions(-)

diff --git a/ubuntu/aufs/dir.c b/ubuntu/aufs/dir.c
index ae582b8..8431955 100644
--- a/ubuntu/aufs/dir.c
+++ b/ubuntu/aufs/dir.c
@@ -547,4 +547,5 @@ struct file_operations aufs_dir_fop = {
.release = aufs_release_dir,
.flush = aufs_flush,
.fsync = aufs_fsync_dir,
+ .fsetattr = aufs_fsetattr,
};
diff --git a/ubuntu/aufs/f_op.c b/ubuntu/aufs/f_op.c
index 0764419..eaab4cf 100644
--- a/ubuntu/aufs/f_op.c
+++ b/ubuntu/aufs/f_op.c
@@ -648,4 +648,5 @@ struct file_operations aufs_file_fop = {
.splice_write = aufs_splice_write,
.splice_read = aufs_splice_read,
#endif
+ .fsetattr = aufs_fsetattr,
};
diff --git a/ubuntu/aufs/i_op.c b/ubuntu/aufs/i_op.c
index b3abee8..7e8bb2f 100644
--- a/ubuntu/aufs/i_op.c
+++ b/ubuntu/aufs/i_op.c
@@ -506,7 +506,8 @@ static int au_lock_and_icpup(struct dentry *dentry, loff_t sz,
return err;
}

-static int aufs_setattr(struct dentry *dentry, struct iattr *ia)
+static int aufs_do_setattr(struct dentry *dentry, struct iattr *ia,
+ struct file *file)
{
int err;
struct inode *inode;
@@ -514,7 +515,6 @@ static int aufs_setattr(struct dentry *dentry, struct iattr *ia)
struct vfsub_args vargs;
struct super_block *sb;
__u32 events;
- struct file *file;
loff_t sz;
struct au_icpup_args rargs;

@@ -525,13 +525,8 @@ static int aufs_setattr(struct dentry *dentry, struct iattr *ia)
sb = dentry->d_sb;
si_read_lock(sb, AuLock_FLUSH);

- file = NULL;
- if (ia->ia_valid & ATTR_FILE) {
- /* currently ftruncate(2) only */
- file = ia->ia_file;
+ if (file)
fi_write_lock(file);
- ia->ia_file = au_h_fptr(file, au_fbstart(file));
- }

sz = -1;
if ((ia->ia_valid & ATTR_SIZE)
@@ -576,16 +571,24 @@ static int aufs_setattr(struct dentry *dentry, struct iattr *ia)
}
di_write_unlock(dentry);
out:
- if (file) {
- ia->ia_file = file;
- /* ia->ia_valid |= ATTR_FILE; */
+ if (file)
fi_write_unlock(file);
- }
+
si_read_unlock(sb);
AuTraceErr(err);
return err;
}

+static int aufs_setattr(struct dentry *dentry, struct iattr *ia)
+{
+ return aufs_do_setattr(dentry, ia, NULL);
+}
+
+int aufs_fsetattr(struct file *file, struct iattr *ia)
+{
+ return aufs_do_setattr(file->f_dentry, ia, file);
+}
+
/* ---------------------------------------------------------------------- */

static int h_readlink(struct dentry *dentry, int bindex, char __user *buf,
diff --git a/ubuntu/aufs/inode.h b/ubuntu/aufs/inode.h
index 1465fd1..213a08a 100644
--- a/ubuntu/aufs/inode.h
+++ b/ubuntu/aufs/inode.h
@@ -65,6 +65,7 @@ int au_test_h_perm_sio(struct inode *h_inode, int mask, int dlgt);

/* i_op.c */
extern struct inode_operations aufs_iop, aufs_symlink_iop, aufs_dir_iop;
+int aufs_fsetattr(struct file *file, struct iattr *ia);

/* au_wr_dir flags */
#define AuWrDir_ADD_ENTRY 1
diff --git a/ubuntu/aufs/misc.c b/ubuntu/aufs/misc.c
index 79588bb..220c843 100644
--- a/ubuntu/aufs/misc.c
+++ b/ubuntu/aufs/misc.c
@@ -254,10 +254,9 @@ int au_copy_file(struct file *dst, struct file *src, loff_t len,
} while (err == -EAGAIN || err == -EINTR);
if (err == 1) {
ia->ia_size = dst->f_pos;
- ia->ia_valid = ATTR_SIZE | ATTR_FILE;
- ia->ia_file = dst;
+ ia->ia_valid = ATTR_SIZE;
mutex_lock_nested(&h_i->i_mutex, AuLsc_I_CHILD2);
- err = vfsub_notify_change(h_d, ia, &vargs);
+ err = vfsub_fnotify_change(h_d, ia, &vargs, dst);
mutex_unlock(&h_i->i_mutex);
}
}
diff --git a/ubuntu/aufs/vfsub.c b/ubuntu/aufs/vfsub.c
index 073ef45..5334822 100644
--- a/ubuntu/aufs/vfsub.c
+++ b/ubuntu/aufs/vfsub.c
@@ -135,7 +135,7 @@ int do_vfsub_symlink(struct inode *dir, struct dentry *dentry,
dir->i_ino, AuDLNPair(dentry), symname, mode);
IMustLock(dir);

- err = vfs_symlink(dir, dentry, symname, mode);
+ err = vfs_symlink(dir, dentry, NULL, symname, mode);
if (!err) {
/* dir inode is locked */
au_update_fuse_h_inode(NULL, dentry->d_parent); /*ignore*/
@@ -152,7 +152,7 @@ int do_vfsub_mknod(struct inode *dir, struct dentry *dentry, int mode,
LKTRTrace("i%lu, %.*s, 0x%x
", dir->i_ino, AuDLNPair(dentry), mode);
IMustLock(dir);

- err = vfs_mknod(dir, dentry, mode, dev);
+ err = vfs_mknod(dir, dentry, NULL, mode, dev);
if (!err) {
/* dir inode is locked */
au_update_fuse_h_inode(NULL, dentry->d_parent); /*ignore*/
@@ -171,7 +171,7 @@ int do_vfsub_link(struct dentry *src_dentry, struct inode *dir,
IMustLock(dir);

lockdep_off();
- err = vfs_link(src_dentry, dir, dentry);
+ err = vfs_link(src_dentry, NULL, dir, dentry, 0);
lockdep_on();
if (!err) {
LKTRTrace("src_i %p, dst_i %p
",
@@ -197,7 +197,7 @@ int do_vfsub_rename(struct inode *src_dir, struct dentry *src_dentry,
IMustLock(src_dir);

lockdep_off();
- err = vfs_rename(src_dir, src_dentry, dir, dentry);
+ err = vfs_rename(src_dir, src_dentry, NULL, dir, dentry, 0);
lockdep_on();
if (!err) {
/* dir inode is locked */
@@ -215,7 +215,7 @@ int do_vfsub_mkdir(struct inode *dir, struct dentry *dentry, int mode)
LKTRTrace("i%lu, %.*s, 0x%x
", dir->i_ino, AuDLNPair(dentry), mode);
IMustLock(dir);

- err = vfs_mkdir(dir, dentry, mode);
+ err = vfs_mkdir(dir, dentry, NULL, mode);
if (!err) {
/* dir inode is locked */
au_update_fuse_h_inode(NULL, dentry->d_parent); /*ignore*/
@@ -232,7 +232,7 @@ int do_vfsub_rmdir(struct inode *dir, struct dentry *dentry)
IMustLock(dir);

lockdep_off();
- err = vfs_rmdir(dir, dentry);
+ err = vfs_rmdir(dir, dentry, 0);
lockdep_on();
/* dir inode is locked */
if (!err)
@@ -249,7 +249,7 @@ int do_vfsub_unlink(struct inode *dir, struct dentry *dentry)

/* vfs_unlink() locks inode */
lockdep_off();
- err = vfs_unlink(dir, dentry);
+ err = vfs_unlink(dir, dentry, 0);
lockdep_on();
/* dir inode is locked */
if (!err)
@@ -464,6 +464,7 @@ struct notify_change_args {
struct dentry *h_dentry;
struct iattr *ia;
struct vfsub_args *vargs;
+ struct file *file;
};

static void call_notify_change(void *args)
@@ -480,7 +481,7 @@ static void call_notify_change(void *args)
if (!IS_IMMUTABLE(h_inode) && !IS_APPEND(h_inode)) {
vfsub_ignore(a->vargs);
lockdep_off();
- *a->errp = notify_change(a->h_dentry, a->ia);
+ *a->errp = fnotify_change(a->h_dentry, NULL, a->ia, a->file);
lockdep_on();
if (!*a->errp)
au_update_fuse_h_inode(NULL, a->h_dentry); /*ignore*/
@@ -511,8 +512,8 @@ static void vfsub_notify_change_dlgt(struct notify_change_args *args,
}
#endif

-int vfsub_notify_change(struct dentry *dentry, struct iattr *ia,
- struct vfsub_args *vargs)
+int vfsub_fnotify_change(struct dentry *dentry, struct iattr *ia,
+ struct vfsub_args *vargs, struct file *file)
{
int err;
struct notify_change_args args = {
@@ -528,6 +529,12 @@ int vfsub_notify_change(struct dentry *dentry, struct iattr *ia,
return err;
}

+int vfsub_notify_change(struct dentry *dentry, struct iattr *ia,
+ struct vfsub_args *vargs)
+{
+ return vfsub_fnotify_change(dentry, ia, vargs, NULL);
+}
+
/* ---------------------------------------------------------------------- */

struct unlink_args {
diff --git a/ubuntu/aufs/vfsub.h b/ubuntu/aufs/vfsub.h
index ddf291a..293f993 100644
--- a/ubuntu/aufs/vfsub.h
+++ b/ubuntu/aufs/vfsub.h
@@ -487,6 +487,8 @@ int vfsub_sio_rmdir(struct inode *dir, struct dentry *dentry, int dlgt);

/* ---------------------------------------------------------------------- */

+int vfsub_fnotify_change(struct dentry *dentry, struct iattr *ia,
+ struct vfsub_args *vargs, struct file *file);
int vfsub_notify_change(struct dentry *dentry, struct iattr *ia,
struct vfsub_args *vargs);
int vfsub_unlink(struct inode *dir, struct dentry *dentry,
--
1.5.4.3


--------------080508020506080109080603
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

--
kernel-team mailing list
kernel-team@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/kernel-team

--------------080508020506080109080603--
 

Thread Tools




All times are GMT. The time now is 02:30 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org