Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 88dcb911 authored by Linus Torvalds's avatar Linus Torvalds
Browse files
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/shaggy/jfs-2.6:
  JFS: add uid, gid, and umask mount options
  JFS: Take logsync lock before testing mp->lsn
  JFS: kzalloc conversion
  JFS: Add missing file from fa3241d2
  JFS: Use the kthread_ API
  JFS: Fix regression.  fsck complains if symlinks do not have INLINEEA attribute
  JFS: ext2 inode attributes for jfs
  JFS: semaphore to mutex conversion.
  JFS: make buddy table static
  JFS: Add back directory i_size calculations for legacy partitions
parents c7cace64 c5111f50
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -8,7 +8,8 @@ jfs-y := super.o file.o inode.o namei.o jfs_mount.o jfs_umount.o \
	    jfs_xtree.o jfs_imap.o jfs_debug.o jfs_dmap.o \
	    jfs_unicode.o jfs_dtree.o jfs_inode.o \
	    jfs_extent.o symlink.o jfs_metapage.o \
	    jfs_logmgr.o jfs_txnmgr.o jfs_uniupr.o resize.o xattr.o
	    jfs_logmgr.o jfs_txnmgr.o jfs_uniupr.o \
	    resize.o xattr.o ioctl.o

jfs-$(CONFIG_JFS_POSIX_ACL) += acl.o

+5 −2
Original line number Diff line number Diff line
@@ -184,6 +184,9 @@ cleanup:
	} else
		inode->i_mode &= ~current->fs->umask;
	
	JFS_IP(inode)->mode2 = (JFS_IP(inode)->mode2 & 0xffff0000) |
			       inode->i_mode;

	return rc;
}

@@ -207,12 +210,12 @@ static int jfs_acl_chmod(struct inode *inode)
	rc = posix_acl_chmod_masq(clone, inode->i_mode);
	if (!rc) {
		tid_t tid = txBegin(inode->i_sb, 0);
		down(&JFS_IP(inode)->commit_sem);
		mutex_lock(&JFS_IP(inode)->commit_mutex);
		rc = jfs_set_acl(tid, inode, ACL_TYPE_ACCESS, clone);
		if (!rc)
			rc = txCommit(tid, 1, &inode, 0);
		txEnd(tid);
		up(&JFS_IP(inode)->commit_sem);
		mutex_unlock(&JFS_IP(inode)->commit_mutex);
	}

	posix_acl_release(clone);
+1 −0
Original line number Diff line number Diff line
@@ -113,4 +113,5 @@ struct file_operations jfs_file_operations = {
 	.sendfile	= generic_file_sendfile,
	.fsync		= jfs_fsync,
	.release	= jfs_release,
	.ioctl		= jfs_ioctl,
};
+8 −7
Original line number Diff line number Diff line
@@ -55,6 +55,7 @@ void jfs_read_inode(struct inode *inode)
		inode->i_op = &jfs_file_inode_operations;
		init_special_inode(inode, inode->i_mode, inode->i_rdev);
	}
	jfs_set_inode_flags(inode);
}

/*
@@ -89,16 +90,16 @@ int jfs_commit_inode(struct inode *inode, int wait)
	}

	tid = txBegin(inode->i_sb, COMMIT_INODE);
	down(&JFS_IP(inode)->commit_sem);
	mutex_lock(&JFS_IP(inode)->commit_mutex);

	/*
	 * Retest inode state after taking commit_sem
	 * Retest inode state after taking commit_mutex
	 */
	if (inode->i_nlink && test_cflag(COMMIT_Dirty, inode))
		rc = txCommit(tid, 1, &inode, wait ? COMMIT_SYNC : 0);

	txEnd(tid);
	up(&JFS_IP(inode)->commit_sem);
	mutex_unlock(&JFS_IP(inode)->commit_mutex);
	return rc;
}

@@ -335,18 +336,18 @@ void jfs_truncate_nolock(struct inode *ip, loff_t length)
		tid = txBegin(ip->i_sb, 0);

		/*
		 * The commit_sem cannot be taken before txBegin.
		 * The commit_mutex cannot be taken before txBegin.
		 * txBegin may block and there is a chance the inode
		 * could be marked dirty and need to be committed
		 * before txBegin unblocks
		 */
		down(&JFS_IP(ip)->commit_sem);
		mutex_lock(&JFS_IP(ip)->commit_mutex);

		newsize = xtTruncate(tid, ip, length,
				     COMMIT_TRUNCATE | COMMIT_PWMAP);
		if (newsize < 0) {
			txEnd(tid);
			up(&JFS_IP(ip)->commit_sem);
			mutex_unlock(&JFS_IP(ip)->commit_mutex);
			break;
		}

@@ -355,7 +356,7 @@ void jfs_truncate_nolock(struct inode *ip, loff_t length)

		txCommit(tid, 1, &ip, 0);
		txEnd(tid);
		up(&JFS_IP(ip)->commit_sem);
		mutex_unlock(&JFS_IP(ip)->commit_mutex);
	} while (newsize > length);	/* Truncate isn't always atomic */
}

fs/jfs/ioctl.c

0 → 100644
+107 −0
Original line number Diff line number Diff line
/*
 * linux/fs/jfs/ioctl.c
 *
 * Copyright (C) 2006 Herbert Poetzl
 * adapted from Remy Card's ext2/ioctl.c
 */

#include <linux/fs.h>
#include <linux/ext2_fs.h>
#include <linux/ctype.h>
#include <linux/capability.h>
#include <linux/time.h>
#include <asm/current.h>
#include <asm/uaccess.h>

#include "jfs_incore.h"
#include "jfs_dinode.h"
#include "jfs_inode.h"


static struct {
	long jfs_flag;
	long ext2_flag;
} jfs_map[] = {
	{JFS_NOATIME_FL, EXT2_NOATIME_FL},
	{JFS_DIRSYNC_FL, EXT2_DIRSYNC_FL},
	{JFS_SYNC_FL, EXT2_SYNC_FL},
	{JFS_SECRM_FL, EXT2_SECRM_FL},
	{JFS_UNRM_FL, EXT2_UNRM_FL},
	{JFS_APPEND_FL, EXT2_APPEND_FL},
	{JFS_IMMUTABLE_FL, EXT2_IMMUTABLE_FL},
	{0, 0},
};

static long jfs_map_ext2(unsigned long flags, int from)
{
	int index=0;
	long mapped=0;

	while (jfs_map[index].jfs_flag) {
		if (from) {
			if (jfs_map[index].ext2_flag & flags)
				mapped |= jfs_map[index].jfs_flag;
		} else {
			if (jfs_map[index].jfs_flag & flags)
				mapped |= jfs_map[index].ext2_flag;
		}
		index++;
	}
	return mapped;
}


int jfs_ioctl(struct inode * inode, struct file * filp, unsigned int cmd,
		unsigned long arg)
{
	struct jfs_inode_info *jfs_inode = JFS_IP(inode);
	unsigned int flags;

	switch (cmd) {
	case JFS_IOC_GETFLAGS:
		flags = jfs_inode->mode2 & JFS_FL_USER_VISIBLE;
		flags = jfs_map_ext2(flags, 0);
		return put_user(flags, (int __user *) arg);
	case JFS_IOC_SETFLAGS: {
		unsigned int oldflags;

		if (IS_RDONLY(inode))
			return -EROFS;

		if ((current->fsuid != inode->i_uid) && !capable(CAP_FOWNER))
			return -EACCES;

		if (get_user(flags, (int __user *) arg))
			return -EFAULT;

		flags = jfs_map_ext2(flags, 1);
		if (!S_ISDIR(inode->i_mode))
			flags &= ~JFS_DIRSYNC_FL;

		oldflags = jfs_inode->mode2;

		/*
		 * The IMMUTABLE and APPEND_ONLY flags can only be changed by
		 * the relevant capability.
		 */
		if ((oldflags & JFS_IMMUTABLE_FL) ||
			((flags ^ oldflags) &
			(JFS_APPEND_FL | JFS_IMMUTABLE_FL))) {
			if (!capable(CAP_LINUX_IMMUTABLE))
				return -EPERM;
		}

		flags = flags & JFS_FL_USER_MODIFIABLE;
		flags |= oldflags & ~JFS_FL_USER_MODIFIABLE;
		jfs_inode->mode2 = flags;

		jfs_set_inode_flags(inode);
		inode->i_ctime = CURRENT_TIME_SEC;
		mark_inode_dirty(inode);
		return 0;
	}
	default:
		return -ENOTTY;
	}
}
Loading