mtd/fs/jffs2 Makefile,1.41,1.42 file.c,1.93,1.94 fs.c,1.29,1.30 os-linux.h,1.33,1.34 super-v24.c,1.74,1.75 super.c,1.88,1.89

David Woodhouse dwmw2 at infradead.org
Mon Oct 6 08:52:32 EDT 2003


Update of /home/cvs/mtd/fs/jffs2
In directory phoenix.infradead.org:/tmp/cvs-serv13606

Modified Files:
	Makefile file.c fs.c os-linux.h super-v24.c super.c 
Log Message:
Implement jffs2_dirty_inode() so that remove_suid() in generic_file_write()
does actually get through to the file system and change the permissions on
the medium.


Index: Makefile
===================================================================
RCS file: /home/cvs/mtd/fs/jffs2/Makefile,v
retrieving revision 1.41
retrieving revision 1.42
diff -u -r1.41 -r1.42
--- Makefile	2 Oct 2003 16:30:46 -0000	1.41
+++ Makefile	6 Oct 2003 12:52:29 -0000	1.42
@@ -10,7 +10,7 @@
 # then $(EXTRA_CFLAGS)
 
 CC += -I$(mtd)/../../include
-EXTRA_CFLAGS := -g -Werror
+EXTRA_CFLAGS :=  -Werror
 
 ifndef CONFIG_MTD
 EXTRA_CFLAGS += -DMTD_OUT_OF_TREE

Index: file.c
===================================================================
RCS file: /home/cvs/mtd/fs/jffs2/file.c,v
retrieving revision 1.93
retrieving revision 1.94
diff -u -r1.93 -r1.94
--- file.c	4 Oct 2003 08:33:06 -0000	1.93
+++ file.c	6 Oct 2003 12:52:29 -0000	1.94
@@ -52,6 +52,8 @@
 
 /* jffs2_file_inode_operations */
 
+static int jffs2_setattr(struct dentry *dentry, struct iattr *iattr);
+
 struct inode_operations jffs2_file_inode_operations =
 {
 	.setattr =	jffs2_setattr
@@ -64,10 +66,9 @@
 	.commit_write =	jffs2_commit_write
 };
 
-int jffs2_setattr (struct dentry *dentry, struct iattr *iattr)
+int jffs2_do_setattr (struct inode *inode, struct iattr *iattr)
 {
 	struct jffs2_full_dnode *old_metadata, *new_metadata;
-	struct inode *inode = dentry->d_inode;
 	struct jffs2_inode_info *f = JFFS2_INODE_INFO(inode);
 	struct jffs2_sb_info *c = JFFS2_SB_INFO(inode->i_sb);
 	struct jffs2_raw_inode *ri;
@@ -89,8 +90,8 @@
 	   it out again with the appropriate data attached */
 	if (S_ISBLK(inode->i_mode) || S_ISCHR(inode->i_mode)) {
 		/* For these, we don't actually need to read the old node */
-		dev =  (major(dentry->d_inode->i_rdev) << 8) | 
-			minor(dentry->d_inode->i_rdev);
+		dev =  (major(inode->i_rdev) << 8) | 
+			minor(inode->i_rdev);
 		mdata = (char *)&dev;
 		mdatalen = sizeof(dev);
 		D1(printk(KERN_DEBUG "jffs2_setattr(): Writing %d bytes of kdev_t\n", mdatalen));
@@ -208,6 +209,11 @@
 	jffs2_complete_reservation(c);
 
 	return 0;
+}
+
+static int jffs2_setattr(struct dentry *dentry, struct iattr *iattr)
+{
+	return jffs2_do_setattr(dentry->d_inode, iattr);
 }
 
 int jffs2_do_readpage_nolock (struct inode *inode, struct page *pg)

Index: fs.c
===================================================================
RCS file: /home/cvs/mtd/fs/jffs2/fs.c,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -r1.29 -r1.30
--- fs.c	4 Oct 2003 08:33:06 -0000	1.29
+++ fs.c	6 Oct 2003 12:52:29 -0000	1.30
@@ -159,6 +159,27 @@
 	D1(printk(KERN_DEBUG "jffs2_read_inode() returning\n"));
 }
 
+void jffs2_dirty_inode(struct inode *inode)
+{
+	struct iattr iattr;
+
+	if (!(inode->i_state & I_DIRTY_DATASYNC)) {
+		D1(printk(KERN_DEBUG "jffs2_dirty_inode() not calling setattr() for ino #%lu\n", inode->i_ino));
+		return;
+	}
+
+	D1(printk(KERN_DEBUG "jffs2_dirty_inode() calling setattr() for ino #%lu\n", inode->i_ino));
+
+	iattr.ia_valid = ATTR_MODE|ATTR_UID|ATTR_GID|ATTR_ATIME|ATTR_MTIME|ATTR_CTIME;
+	iattr.ia_mode = inode->i_mode;
+	iattr.ia_uid = inode->i_uid;
+	iattr.ia_gid = inode->i_gid;
+	iattr.ia_atime = inode->i_atime;
+	iattr.ia_mtime = inode->i_mtime;
+	iattr.ia_ctime = inode->i_ctime;
+
+	jffs2_do_setattr(inode, &iattr);
+}
 
 int jffs2_remount_fs (struct super_block *sb, int *flags, char *data)
 {

Index: os-linux.h
===================================================================
RCS file: /home/cvs/mtd/fs/jffs2/os-linux.h,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -r1.33 -r1.34
--- os-linux.h	4 Oct 2003 08:33:06 -0000	1.33
+++ os-linux.h	6 Oct 2003 12:52:29 -0000	1.34
@@ -160,7 +160,7 @@
 extern struct inode_operations jffs2_file_inode_operations;
 extern struct address_space_operations jffs2_file_address_operations;
 int jffs2_fsync(struct file *, struct dentry *, int);
-int jffs2_setattr (struct dentry *dentry, struct iattr *iattr);
+int jffs2_do_setattr (struct inode *inode, struct iattr *iattr);
 int jffs2_do_readpage_nolock (struct inode *inode, struct page *pg);
 int jffs2_do_readpage_unlock (struct inode *inode, struct page *pg);
 int jffs2_readpage (struct file *, struct page *);
@@ -176,6 +176,7 @@
 /* fs.c */
 void jffs2_read_inode (struct inode *);
 void jffs2_clear_inode (struct inode *);
+void jffs2_dirty_inode(struct inode *inode);
 struct inode *jffs2_new_inode (struct inode *dir_i, int mode,
 			       struct jffs2_raw_inode *ri);
 int jffs2_statfs (struct super_block *, struct kstatfs *);

Index: super-v24.c
===================================================================
RCS file: /home/cvs/mtd/fs/jffs2/super-v24.c,v
retrieving revision 1.74
retrieving revision 1.75
diff -u -r1.74 -r1.75
--- super-v24.c	4 Oct 2003 08:58:42 -0000	1.74
+++ super-v24.c	6 Oct 2003 12:52:29 -0000	1.75
@@ -32,12 +32,13 @@
 
 static struct super_operations jffs2_super_operations =
 {
-	read_inode:	jffs2_read_inode,
-	put_super:	jffs2_put_super,
-	write_super:	jffs2_write_super,
-	statfs:		jffs2_statfs,
-	remount_fs:	jffs2_remount_fs,
-	clear_inode:	jffs2_clear_inode,
+	.read_inode =	jffs2_read_inode,
+	.put_super =	jffs2_put_super,
+	.write_super =	jffs2_write_super,
+	.statfs =	jffs2_statfs,
+	.remount_fs =	jffs2_remount_fs,
+	.clear_inode =	jffs2_clear_inode,
+	.dirty_inode =	jffs2_dirty_inode,
 };
 
 

Index: super.c
===================================================================
RCS file: /home/cvs/mtd/fs/jffs2/super.c,v
retrieving revision 1.88
retrieving revision 1.89
diff -u -r1.88 -r1.89
--- super.c	4 Oct 2003 08:58:42 -0000	1.88
+++ super.c	6 Oct 2003 12:52:29 -0000	1.89
@@ -66,6 +66,7 @@
 	.statfs =	jffs2_statfs,
 	.remount_fs =	jffs2_remount_fs,
 	.clear_inode =	jffs2_clear_inode,
+	.dirty_inode =	jffs2_dirty_inode,
 };
 
 static int jffs2_sb_compare(struct super_block *sb, void *data)




More information about the linux-mtd-cvs mailing list