You've already forked linux-apfs
mirror of
https://github.com/linux-apfs/linux-apfs.git
synced 2026-05-01 15:00:59 -07:00
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs-2.6
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs-2.6: (69 commits) fix handling of offsets in cris eeprom.c, get rid of fake on-stack files get rid of home-grown mutex in cris eeprom.c switch ecryptfs_write() to struct inode *, kill on-stack fake files switch ecryptfs_get_locked_page() to struct inode * simplify access to ecryptfs inodes in ->readpage() and friends AFS: Don't put struct file on the stack Ban ecryptfs over ecryptfs logfs: replace inode uid,gid,mode initialization with helper function ufs: replace inode uid,gid,mode initialization with helper function udf: replace inode uid,gid,mode init with helper ubifs: replace inode uid,gid,mode initialization with helper function sysv: replace inode uid,gid,mode initialization with helper function reiserfs: replace inode uid,gid,mode initialization with helper function ramfs: replace inode uid,gid,mode initialization with helper function omfs: replace inode uid,gid,mode initialization with helper function bfs: replace inode uid,gid,mode initialization with helper function ocfs2: replace inode uid,gid,mode initialization with helper function nilfs2: replace inode uid,gid,mode initialization with helper function minix: replace inode uid,gid,mode init with helper ext4: replace inode uid,gid,mode init with helper ... Trivial conflict in fs/fs-writeback.c (mark bitfields unsigned)
This commit is contained in:
@@ -73,8 +73,7 @@ struct eeprom_type
|
|||||||
int adapt_state; /* 1 = To high , 0 = Even, -1 = To low */
|
int adapt_state; /* 1 = To high , 0 = Even, -1 = To low */
|
||||||
|
|
||||||
/* this one is to keep the read/write operations atomic */
|
/* this one is to keep the read/write operations atomic */
|
||||||
wait_queue_head_t wait_q;
|
struct mutex lock;
|
||||||
volatile int busy;
|
|
||||||
int retry_cnt_addr; /* Used to keep track of number of retries for
|
int retry_cnt_addr; /* Used to keep track of number of retries for
|
||||||
adaptive timing adjustments */
|
adaptive timing adjustments */
|
||||||
int retry_cnt_read;
|
int retry_cnt_read;
|
||||||
@@ -115,8 +114,7 @@ const struct file_operations eeprom_fops =
|
|||||||
|
|
||||||
int __init eeprom_init(void)
|
int __init eeprom_init(void)
|
||||||
{
|
{
|
||||||
init_waitqueue_head(&eeprom.wait_q);
|
mutex_init(&eeprom.lock);
|
||||||
eeprom.busy = 0;
|
|
||||||
|
|
||||||
#ifdef CONFIG_ETRAX_I2C_EEPROM_PROBE
|
#ifdef CONFIG_ETRAX_I2C_EEPROM_PROBE
|
||||||
#define EETEXT "Found"
|
#define EETEXT "Found"
|
||||||
@@ -439,10 +437,7 @@ static loff_t eeprom_lseek(struct file * file, loff_t offset, int orig)
|
|||||||
|
|
||||||
static int eeprom_read_buf(loff_t addr, char * buf, int count)
|
static int eeprom_read_buf(loff_t addr, char * buf, int count)
|
||||||
{
|
{
|
||||||
struct file f;
|
return eeprom_read(NULL, buf, count, &addr);
|
||||||
|
|
||||||
f.f_pos = addr;
|
|
||||||
return eeprom_read(&f, buf, count, &addr);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -452,7 +447,7 @@ static int eeprom_read_buf(loff_t addr, char * buf, int count)
|
|||||||
static ssize_t eeprom_read(struct file * file, char * buf, size_t count, loff_t *off)
|
static ssize_t eeprom_read(struct file * file, char * buf, size_t count, loff_t *off)
|
||||||
{
|
{
|
||||||
int read=0;
|
int read=0;
|
||||||
unsigned long p = file->f_pos;
|
unsigned long p = *off;
|
||||||
|
|
||||||
unsigned char page;
|
unsigned char page;
|
||||||
|
|
||||||
@@ -461,12 +456,9 @@ static ssize_t eeprom_read(struct file * file, char * buf, size_t count, loff_t
|
|||||||
return -EFAULT;
|
return -EFAULT;
|
||||||
}
|
}
|
||||||
|
|
||||||
wait_event_interruptible(eeprom.wait_q, !eeprom.busy);
|
if (mutex_lock_interruptible(&eeprom.lock))
|
||||||
if (signal_pending(current))
|
|
||||||
return -EINTR;
|
return -EINTR;
|
||||||
|
|
||||||
eeprom.busy++;
|
|
||||||
|
|
||||||
page = (unsigned char) (p >> 8);
|
page = (unsigned char) (p >> 8);
|
||||||
|
|
||||||
if(!eeprom_address(p))
|
if(!eeprom_address(p))
|
||||||
@@ -476,8 +468,7 @@ static ssize_t eeprom_read(struct file * file, char * buf, size_t count, loff_t
|
|||||||
i2c_stop();
|
i2c_stop();
|
||||||
|
|
||||||
/* don't forget to wake them up */
|
/* don't forget to wake them up */
|
||||||
eeprom.busy--;
|
mutex_unlock(&eeprom.lock);
|
||||||
wake_up_interruptible(&eeprom.wait_q);
|
|
||||||
return -EFAULT;
|
return -EFAULT;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -501,11 +492,10 @@ static ssize_t eeprom_read(struct file * file, char * buf, size_t count, loff_t
|
|||||||
|
|
||||||
if(read > 0)
|
if(read > 0)
|
||||||
{
|
{
|
||||||
file->f_pos += read;
|
*off += read;
|
||||||
}
|
}
|
||||||
|
|
||||||
eeprom.busy--;
|
mutex_unlock(&eeprom.lock);
|
||||||
wake_up_interruptible(&eeprom.wait_q);
|
|
||||||
return read;
|
return read;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -513,11 +503,7 @@ static ssize_t eeprom_read(struct file * file, char * buf, size_t count, loff_t
|
|||||||
|
|
||||||
static int eeprom_write_buf(loff_t addr, const char * buf, int count)
|
static int eeprom_write_buf(loff_t addr, const char * buf, int count)
|
||||||
{
|
{
|
||||||
struct file f;
|
return eeprom_write(NULL, buf, count, &addr);
|
||||||
|
|
||||||
f.f_pos = addr;
|
|
||||||
|
|
||||||
return eeprom_write(&f, buf, count, &addr);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -534,16 +520,14 @@ static ssize_t eeprom_write(struct file * file, const char * buf, size_t count,
|
|||||||
return -EFAULT;
|
return -EFAULT;
|
||||||
}
|
}
|
||||||
|
|
||||||
wait_event_interruptible(eeprom.wait_q, !eeprom.busy);
|
|
||||||
/* bail out if we get interrupted */
|
/* bail out if we get interrupted */
|
||||||
if (signal_pending(current))
|
if (mutex_lock_interruptible(&eeprom.lock))
|
||||||
return -EINTR;
|
return -EINTR;
|
||||||
eeprom.busy++;
|
|
||||||
for(i = 0; (i < EEPROM_RETRIES) && (restart > 0); i++)
|
for(i = 0; (i < EEPROM_RETRIES) && (restart > 0); i++)
|
||||||
{
|
{
|
||||||
restart = 0;
|
restart = 0;
|
||||||
written = 0;
|
written = 0;
|
||||||
p = file->f_pos;
|
p = *off;
|
||||||
|
|
||||||
|
|
||||||
while( (written < count) && (p < eeprom.size))
|
while( (written < count) && (p < eeprom.size))
|
||||||
@@ -556,8 +540,7 @@ static ssize_t eeprom_write(struct file * file, const char * buf, size_t count,
|
|||||||
i2c_stop();
|
i2c_stop();
|
||||||
|
|
||||||
/* don't forget to wake them up */
|
/* don't forget to wake them up */
|
||||||
eeprom.busy--;
|
mutex_unlock(&eeprom.lock);
|
||||||
wake_up_interruptible(&eeprom.wait_q);
|
|
||||||
return -EFAULT;
|
return -EFAULT;
|
||||||
}
|
}
|
||||||
#ifdef EEPROM_ADAPTIVE_TIMING
|
#ifdef EEPROM_ADAPTIVE_TIMING
|
||||||
@@ -669,12 +652,11 @@ static ssize_t eeprom_write(struct file * file, const char * buf, size_t count,
|
|||||||
} /* while */
|
} /* while */
|
||||||
} /* for */
|
} /* for */
|
||||||
|
|
||||||
eeprom.busy--;
|
mutex_unlock(&eeprom.lock);
|
||||||
wake_up_interruptible(&eeprom.wait_q);
|
if (written == 0 && p >= eeprom.size){
|
||||||
if (written == 0 && file->f_pos >= eeprom.size){
|
|
||||||
return -ENOSPC;
|
return -ENOSPC;
|
||||||
}
|
}
|
||||||
file->f_pos += written;
|
*off = p;
|
||||||
return written;
|
return written;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -485,7 +485,7 @@ static int do_bio_filebacked(struct loop_device *lo, struct bio *bio)
|
|||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = vfs_fsync(file, file->f_path.dentry, 0);
|
ret = vfs_fsync(file, 0);
|
||||||
if (unlikely(ret)) {
|
if (unlikely(ret)) {
|
||||||
ret = -EIO;
|
ret = -EIO;
|
||||||
goto out;
|
goto out;
|
||||||
@@ -495,7 +495,7 @@ static int do_bio_filebacked(struct loop_device *lo, struct bio *bio)
|
|||||||
ret = lo_send(lo, bio, pos);
|
ret = lo_send(lo, bio, pos);
|
||||||
|
|
||||||
if (barrier && !ret) {
|
if (barrier && !ret) {
|
||||||
ret = vfs_fsync(file, file->f_path.dentry, 0);
|
ret = vfs_fsync(file, 0);
|
||||||
if (unlikely(ret))
|
if (unlikely(ret))
|
||||||
ret = -EIO;
|
ret = -EIO;
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -1699,7 +1699,7 @@ int bitmap_create(mddev_t *mddev)
|
|||||||
* and bypass the page cache, we must sync the file
|
* and bypass the page cache, we must sync the file
|
||||||
* first.
|
* first.
|
||||||
*/
|
*/
|
||||||
vfs_fsync(file, file->f_dentry, 1);
|
vfs_fsync(file, 1);
|
||||||
}
|
}
|
||||||
/* read superblock from bitmap file (this sets mddev->bitmap_info.chunksize) */
|
/* read superblock from bitmap file (this sets mddev->bitmap_info.chunksize) */
|
||||||
if (!mddev->bitmap_info.external)
|
if (!mddev->bitmap_info.external)
|
||||||
|
|||||||
@@ -654,7 +654,7 @@ static int fsg_lun_fsync_sub(struct fsg_lun *curlun)
|
|||||||
|
|
||||||
if (curlun->ro || !filp)
|
if (curlun->ro || !filp)
|
||||||
return 0;
|
return 0;
|
||||||
return vfs_fsync(filp, filp->f_path.dentry, 1);
|
return vfs_fsync(filp, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void store_cdrom_address(u8 *dest, int msf, u32 addr)
|
static void store_cdrom_address(u8 *dest, int msf, u32 addr)
|
||||||
|
|||||||
+1
-3
@@ -253,9 +253,7 @@ struct inode *v9fs_get_inode(struct super_block *sb, int mode)
|
|||||||
return ERR_PTR(-ENOMEM);
|
return ERR_PTR(-ENOMEM);
|
||||||
}
|
}
|
||||||
|
|
||||||
inode->i_mode = mode;
|
inode_init_owner(inode, NULL, mode);
|
||||||
inode->i_uid = current_fsuid();
|
|
||||||
inode->i_gid = current_fsgid();
|
|
||||||
inode->i_blocks = 0;
|
inode->i_blocks = 0;
|
||||||
inode->i_rdev = 0;
|
inode->i_rdev = 0;
|
||||||
inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME;
|
inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME;
|
||||||
|
|||||||
+1
-1
@@ -11,7 +11,7 @@ obj-y := open.o read_write.o file_table.o super.o \
|
|||||||
attr.o bad_inode.o file.o filesystems.o namespace.o \
|
attr.o bad_inode.o file.o filesystems.o namespace.o \
|
||||||
seq_file.o xattr.o libfs.o fs-writeback.o \
|
seq_file.o xattr.o libfs.o fs-writeback.o \
|
||||||
pnode.o drop_caches.o splice.o sync.o utimes.o \
|
pnode.o drop_caches.o splice.o sync.o utimes.o \
|
||||||
stack.o fs_struct.o
|
stack.o fs_struct.o statfs.o
|
||||||
|
|
||||||
ifeq ($(CONFIG_BLOCK),y)
|
ifeq ($(CONFIG_BLOCK),y)
|
||||||
obj-y += buffer.o bio.o block_dev.o direct-io.o mpage.o ioprio.o
|
obj-y += buffer.o bio.o block_dev.o direct-io.o mpage.o ioprio.o
|
||||||
|
|||||||
+1
-5
@@ -189,13 +189,9 @@ static struct page *afs_dir_get_page(struct inode *dir, unsigned long index,
|
|||||||
struct key *key)
|
struct key *key)
|
||||||
{
|
{
|
||||||
struct page *page;
|
struct page *page;
|
||||||
struct file file = {
|
|
||||||
.private_data = key,
|
|
||||||
};
|
|
||||||
|
|
||||||
_enter("{%lu},%lu", dir->i_ino, index);
|
_enter("{%lu},%lu", dir->i_ino, index);
|
||||||
|
|
||||||
page = read_mapping_page(dir->i_mapping, index, &file);
|
page = read_cache_page(dir->i_mapping, index, afs_page_filler, key);
|
||||||
if (!IS_ERR(page)) {
|
if (!IS_ERR(page)) {
|
||||||
kmap(page);
|
kmap(page);
|
||||||
if (!PageChecked(page))
|
if (!PageChecked(page))
|
||||||
|
|||||||
+37
-27
@@ -121,34 +121,19 @@ static void afs_file_readpage_read_complete(struct page *page,
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* AFS read page from file, directory or symlink
|
* read page from file, directory or symlink, given a key to use
|
||||||
*/
|
*/
|
||||||
static int afs_readpage(struct file *file, struct page *page)
|
int afs_page_filler(void *data, struct page *page)
|
||||||
{
|
{
|
||||||
struct afs_vnode *vnode;
|
struct inode *inode = page->mapping->host;
|
||||||
struct inode *inode;
|
struct afs_vnode *vnode = AFS_FS_I(inode);
|
||||||
struct key *key;
|
struct key *key = data;
|
||||||
size_t len;
|
size_t len;
|
||||||
off_t offset;
|
off_t offset;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
inode = page->mapping->host;
|
|
||||||
|
|
||||||
if (file) {
|
|
||||||
key = file->private_data;
|
|
||||||
ASSERT(key != NULL);
|
|
||||||
} else {
|
|
||||||
key = afs_request_key(AFS_FS_S(inode->i_sb)->volume->cell);
|
|
||||||
if (IS_ERR(key)) {
|
|
||||||
ret = PTR_ERR(key);
|
|
||||||
goto error_nokey;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
_enter("{%x},{%lu},{%lu}", key_serial(key), inode->i_ino, page->index);
|
_enter("{%x},{%lu},{%lu}", key_serial(key), inode->i_ino, page->index);
|
||||||
|
|
||||||
vnode = AFS_FS_I(inode);
|
|
||||||
|
|
||||||
BUG_ON(!PageLocked(page));
|
BUG_ON(!PageLocked(page));
|
||||||
|
|
||||||
ret = -ESTALE;
|
ret = -ESTALE;
|
||||||
@@ -214,31 +199,56 @@ static int afs_readpage(struct file *file, struct page *page)
|
|||||||
unlock_page(page);
|
unlock_page(page);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!file)
|
|
||||||
key_put(key);
|
|
||||||
_leave(" = 0");
|
_leave(" = 0");
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
error:
|
error:
|
||||||
SetPageError(page);
|
SetPageError(page);
|
||||||
unlock_page(page);
|
unlock_page(page);
|
||||||
if (!file)
|
|
||||||
key_put(key);
|
|
||||||
error_nokey:
|
|
||||||
_leave(" = %d", ret);
|
_leave(" = %d", ret);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* read page from file, directory or symlink, given a file to nominate the key
|
||||||
|
* to be used
|
||||||
|
*/
|
||||||
|
static int afs_readpage(struct file *file, struct page *page)
|
||||||
|
{
|
||||||
|
struct key *key;
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
if (file) {
|
||||||
|
key = file->private_data;
|
||||||
|
ASSERT(key != NULL);
|
||||||
|
ret = afs_page_filler(key, page);
|
||||||
|
} else {
|
||||||
|
struct inode *inode = page->mapping->host;
|
||||||
|
key = afs_request_key(AFS_FS_S(inode->i_sb)->volume->cell);
|
||||||
|
if (IS_ERR(key)) {
|
||||||
|
ret = PTR_ERR(key);
|
||||||
|
} else {
|
||||||
|
ret = afs_page_filler(key, page);
|
||||||
|
key_put(key);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* read a set of pages
|
* read a set of pages
|
||||||
*/
|
*/
|
||||||
static int afs_readpages(struct file *file, struct address_space *mapping,
|
static int afs_readpages(struct file *file, struct address_space *mapping,
|
||||||
struct list_head *pages, unsigned nr_pages)
|
struct list_head *pages, unsigned nr_pages)
|
||||||
{
|
{
|
||||||
|
struct key *key = file->private_data;
|
||||||
struct afs_vnode *vnode;
|
struct afs_vnode *vnode;
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
_enter(",{%lu},,%d", mapping->host->i_ino, nr_pages);
|
_enter("{%d},{%lu},,%d",
|
||||||
|
key_serial(key), mapping->host->i_ino, nr_pages);
|
||||||
|
|
||||||
|
ASSERT(key != NULL);
|
||||||
|
|
||||||
vnode = AFS_FS_I(mapping->host);
|
vnode = AFS_FS_I(mapping->host);
|
||||||
if (vnode->flags & AFS_VNODE_DELETED) {
|
if (vnode->flags & AFS_VNODE_DELETED) {
|
||||||
@@ -279,7 +289,7 @@ static int afs_readpages(struct file *file, struct address_space *mapping,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* load the missing pages from the network */
|
/* load the missing pages from the network */
|
||||||
ret = read_cache_pages(mapping, pages, (void *) afs_readpage, file);
|
ret = read_cache_pages(mapping, pages, afs_page_filler, key);
|
||||||
|
|
||||||
_leave(" = %d [netting]", ret);
|
_leave(" = %d [netting]", ret);
|
||||||
return ret;
|
return ret;
|
||||||
|
|||||||
@@ -494,6 +494,7 @@ extern const struct file_operations afs_file_operations;
|
|||||||
|
|
||||||
extern int afs_open(struct inode *, struct file *);
|
extern int afs_open(struct inode *, struct file *);
|
||||||
extern int afs_release(struct inode *, struct file *);
|
extern int afs_release(struct inode *, struct file *);
|
||||||
|
extern int afs_page_filler(void *, struct page *);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* flock.c
|
* flock.c
|
||||||
|
|||||||
+2
-4
@@ -49,9 +49,6 @@ static unsigned long afs_mntpt_expiry_timeout = 10 * 60;
|
|||||||
*/
|
*/
|
||||||
int afs_mntpt_check_symlink(struct afs_vnode *vnode, struct key *key)
|
int afs_mntpt_check_symlink(struct afs_vnode *vnode, struct key *key)
|
||||||
{
|
{
|
||||||
struct file file = {
|
|
||||||
.private_data = key,
|
|
||||||
};
|
|
||||||
struct page *page;
|
struct page *page;
|
||||||
size_t size;
|
size_t size;
|
||||||
char *buf;
|
char *buf;
|
||||||
@@ -61,7 +58,8 @@ int afs_mntpt_check_symlink(struct afs_vnode *vnode, struct key *key)
|
|||||||
vnode->fid.vid, vnode->fid.vnode, vnode->fid.unique);
|
vnode->fid.vid, vnode->fid.vnode, vnode->fid.unique);
|
||||||
|
|
||||||
/* read the contents of the symlink into the pagecache */
|
/* read the contents of the symlink into the pagecache */
|
||||||
page = read_mapping_page(AFS_VNODE_TO_I(vnode)->i_mapping, 0, &file);
|
page = read_cache_page(AFS_VNODE_TO_I(vnode)->i_mapping, 0,
|
||||||
|
afs_page_filler, key);
|
||||||
if (IS_ERR(page)) {
|
if (IS_ERR(page)) {
|
||||||
ret = PTR_ERR(page);
|
ret = PTR_ERR(page);
|
||||||
goto out;
|
goto out;
|
||||||
|
|||||||
+1
-1
@@ -205,7 +205,7 @@ static struct inode *anon_inode_mkinode(void)
|
|||||||
* that it already _is_ on the dirty list.
|
* that it already _is_ on the dirty list.
|
||||||
*/
|
*/
|
||||||
inode->i_state = I_DIRTY;
|
inode->i_state = I_DIRTY;
|
||||||
inode->i_mode = S_IRUSR | S_IWUSR;
|
inode->i_mode = S_IFREG | S_IRUSR | S_IWUSR;
|
||||||
inode->i_uid = current_fsuid();
|
inode->i_uid = current_fsuid();
|
||||||
inode->i_gid = current_fsgid();
|
inode->i_gid = current_fsgid();
|
||||||
inode->i_flags |= S_PRIVATE;
|
inode->i_flags |= S_PRIVATE;
|
||||||
|
|||||||
+1
-3
@@ -105,14 +105,12 @@ static int bfs_create(struct inode *dir, struct dentry *dentry, int mode,
|
|||||||
}
|
}
|
||||||
set_bit(ino, info->si_imap);
|
set_bit(ino, info->si_imap);
|
||||||
info->si_freei--;
|
info->si_freei--;
|
||||||
inode->i_uid = current_fsuid();
|
inode_init_owner(inode, dir, mode);
|
||||||
inode->i_gid = (dir->i_mode & S_ISGID) ? dir->i_gid : current_fsgid();
|
|
||||||
inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME_SEC;
|
inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME_SEC;
|
||||||
inode->i_blocks = 0;
|
inode->i_blocks = 0;
|
||||||
inode->i_op = &bfs_file_inops;
|
inode->i_op = &bfs_file_inops;
|
||||||
inode->i_fop = &bfs_file_operations;
|
inode->i_fop = &bfs_file_operations;
|
||||||
inode->i_mapping->a_ops = &bfs_aops;
|
inode->i_mapping->a_ops = &bfs_aops;
|
||||||
inode->i_mode = mode;
|
|
||||||
inode->i_ino = ino;
|
inode->i_ino = ino;
|
||||||
BFS_I(inode)->i_dsk_ino = ino;
|
BFS_I(inode)->i_dsk_ino = ino;
|
||||||
BFS_I(inode)->i_sblock = 0;
|
BFS_I(inode)->i_sblock = 0;
|
||||||
|
|||||||
+15
-56
@@ -245,37 +245,14 @@ struct super_block *freeze_bdev(struct block_device *bdev)
|
|||||||
sb = get_active_super(bdev);
|
sb = get_active_super(bdev);
|
||||||
if (!sb)
|
if (!sb)
|
||||||
goto out;
|
goto out;
|
||||||
if (sb->s_flags & MS_RDONLY) {
|
error = freeze_super(sb);
|
||||||
sb->s_frozen = SB_FREEZE_TRANS;
|
if (error) {
|
||||||
up_write(&sb->s_umount);
|
deactivate_super(sb);
|
||||||
|
bdev->bd_fsfreeze_count--;
|
||||||
mutex_unlock(&bdev->bd_fsfreeze_mutex);
|
mutex_unlock(&bdev->bd_fsfreeze_mutex);
|
||||||
return sb;
|
return ERR_PTR(error);
|
||||||
}
|
}
|
||||||
|
deactivate_super(sb);
|
||||||
sb->s_frozen = SB_FREEZE_WRITE;
|
|
||||||
smp_wmb();
|
|
||||||
|
|
||||||
sync_filesystem(sb);
|
|
||||||
|
|
||||||
sb->s_frozen = SB_FREEZE_TRANS;
|
|
||||||
smp_wmb();
|
|
||||||
|
|
||||||
sync_blockdev(sb->s_bdev);
|
|
||||||
|
|
||||||
if (sb->s_op->freeze_fs) {
|
|
||||||
error = sb->s_op->freeze_fs(sb);
|
|
||||||
if (error) {
|
|
||||||
printk(KERN_ERR
|
|
||||||
"VFS:Filesystem freeze failed\n");
|
|
||||||
sb->s_frozen = SB_UNFROZEN;
|
|
||||||
deactivate_locked_super(sb);
|
|
||||||
bdev->bd_fsfreeze_count--;
|
|
||||||
mutex_unlock(&bdev->bd_fsfreeze_mutex);
|
|
||||||
return ERR_PTR(error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
up_write(&sb->s_umount);
|
|
||||||
|
|
||||||
out:
|
out:
|
||||||
sync_blockdev(bdev);
|
sync_blockdev(bdev);
|
||||||
mutex_unlock(&bdev->bd_fsfreeze_mutex);
|
mutex_unlock(&bdev->bd_fsfreeze_mutex);
|
||||||
@@ -296,40 +273,22 @@ int thaw_bdev(struct block_device *bdev, struct super_block *sb)
|
|||||||
|
|
||||||
mutex_lock(&bdev->bd_fsfreeze_mutex);
|
mutex_lock(&bdev->bd_fsfreeze_mutex);
|
||||||
if (!bdev->bd_fsfreeze_count)
|
if (!bdev->bd_fsfreeze_count)
|
||||||
goto out_unlock;
|
goto out;
|
||||||
|
|
||||||
error = 0;
|
error = 0;
|
||||||
if (--bdev->bd_fsfreeze_count > 0)
|
if (--bdev->bd_fsfreeze_count > 0)
|
||||||
goto out_unlock;
|
goto out;
|
||||||
|
|
||||||
if (!sb)
|
if (!sb)
|
||||||
goto out_unlock;
|
goto out;
|
||||||
|
|
||||||
BUG_ON(sb->s_bdev != bdev);
|
error = thaw_super(sb);
|
||||||
down_write(&sb->s_umount);
|
if (error) {
|
||||||
if (sb->s_flags & MS_RDONLY)
|
bdev->bd_fsfreeze_count++;
|
||||||
goto out_unfrozen;
|
mutex_unlock(&bdev->bd_fsfreeze_mutex);
|
||||||
|
return error;
|
||||||
if (sb->s_op->unfreeze_fs) {
|
|
||||||
error = sb->s_op->unfreeze_fs(sb);
|
|
||||||
if (error) {
|
|
||||||
printk(KERN_ERR
|
|
||||||
"VFS:Filesystem thaw failed\n");
|
|
||||||
sb->s_frozen = SB_FREEZE_TRANS;
|
|
||||||
bdev->bd_fsfreeze_count++;
|
|
||||||
mutex_unlock(&bdev->bd_fsfreeze_mutex);
|
|
||||||
return error;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
out:
|
||||||
out_unfrozen:
|
|
||||||
sb->s_frozen = SB_UNFROZEN;
|
|
||||||
smp_wmb();
|
|
||||||
wake_up(&sb->s_wait_unfrozen);
|
|
||||||
|
|
||||||
if (sb)
|
|
||||||
deactivate_locked_super(sb);
|
|
||||||
out_unlock:
|
|
||||||
mutex_unlock(&bdev->bd_fsfreeze_mutex);
|
mutex_unlock(&bdev->bd_fsfreeze_mutex);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -282,14 +282,14 @@ int btrfs_acl_chmod(struct inode *inode)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct xattr_handler btrfs_xattr_acl_default_handler = {
|
const struct xattr_handler btrfs_xattr_acl_default_handler = {
|
||||||
.prefix = POSIX_ACL_XATTR_DEFAULT,
|
.prefix = POSIX_ACL_XATTR_DEFAULT,
|
||||||
.flags = ACL_TYPE_DEFAULT,
|
.flags = ACL_TYPE_DEFAULT,
|
||||||
.get = btrfs_xattr_acl_get,
|
.get = btrfs_xattr_acl_get,
|
||||||
.set = btrfs_xattr_acl_set,
|
.set = btrfs_xattr_acl_set,
|
||||||
};
|
};
|
||||||
|
|
||||||
struct xattr_handler btrfs_xattr_acl_access_handler = {
|
const struct xattr_handler btrfs_xattr_acl_access_handler = {
|
||||||
.prefix = POSIX_ACL_XATTR_ACCESS,
|
.prefix = POSIX_ACL_XATTR_ACCESS,
|
||||||
.flags = ACL_TYPE_ACCESS,
|
.flags = ACL_TYPE_ACCESS,
|
||||||
.get = btrfs_xattr_acl_get,
|
.get = btrfs_xattr_acl_get,
|
||||||
|
|||||||
+1
-10
@@ -4121,16 +4121,7 @@ static struct inode *btrfs_new_inode(struct btrfs_trans_handle *trans,
|
|||||||
if (ret != 0)
|
if (ret != 0)
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
inode->i_uid = current_fsuid();
|
inode_init_owner(inode, dir, mode);
|
||||||
|
|
||||||
if (dir && (dir->i_mode & S_ISGID)) {
|
|
||||||
inode->i_gid = dir->i_gid;
|
|
||||||
if (S_ISDIR(mode))
|
|
||||||
mode |= S_ISGID;
|
|
||||||
} else
|
|
||||||
inode->i_gid = current_fsgid();
|
|
||||||
|
|
||||||
inode->i_mode = mode;
|
|
||||||
inode->i_ino = objectid;
|
inode->i_ino = objectid;
|
||||||
inode_set_bytes(inode, 0);
|
inode_set_bytes(inode, 0);
|
||||||
inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME;
|
inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME;
|
||||||
|
|||||||
+1
-1
@@ -282,7 +282,7 @@ err:
|
|||||||
* List of handlers for synthetic system.* attributes. All real ondisk
|
* List of handlers for synthetic system.* attributes. All real ondisk
|
||||||
* attributes are handled directly.
|
* attributes are handled directly.
|
||||||
*/
|
*/
|
||||||
struct xattr_handler *btrfs_xattr_handlers[] = {
|
const struct xattr_handler *btrfs_xattr_handlers[] = {
|
||||||
#ifdef CONFIG_BTRFS_FS_POSIX_ACL
|
#ifdef CONFIG_BTRFS_FS_POSIX_ACL
|
||||||
&btrfs_xattr_acl_access_handler,
|
&btrfs_xattr_acl_access_handler,
|
||||||
&btrfs_xattr_acl_default_handler,
|
&btrfs_xattr_acl_default_handler,
|
||||||
|
|||||||
+3
-3
@@ -21,9 +21,9 @@
|
|||||||
|
|
||||||
#include <linux/xattr.h>
|
#include <linux/xattr.h>
|
||||||
|
|
||||||
extern struct xattr_handler btrfs_xattr_acl_access_handler;
|
extern const struct xattr_handler btrfs_xattr_acl_access_handler;
|
||||||
extern struct xattr_handler btrfs_xattr_acl_default_handler;
|
extern const struct xattr_handler btrfs_xattr_acl_default_handler;
|
||||||
extern struct xattr_handler *btrfs_xattr_handlers[];
|
extern const struct xattr_handler *btrfs_xattr_handlers[];
|
||||||
|
|
||||||
extern ssize_t __btrfs_getxattr(struct inode *inode, const char *name,
|
extern ssize_t __btrfs_getxattr(struct inode *inode, const char *name,
|
||||||
void *buffer, size_t size);
|
void *buffer, size_t size);
|
||||||
|
|||||||
+9
-18
@@ -561,26 +561,17 @@ repeat:
|
|||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void do_thaw_one(struct super_block *sb, void *unused)
|
||||||
|
{
|
||||||
|
char b[BDEVNAME_SIZE];
|
||||||
|
while (sb->s_bdev && !thaw_bdev(sb->s_bdev, sb))
|
||||||
|
printk(KERN_WARNING "Emergency Thaw on %s\n",
|
||||||
|
bdevname(sb->s_bdev, b));
|
||||||
|
}
|
||||||
|
|
||||||
static void do_thaw_all(struct work_struct *work)
|
static void do_thaw_all(struct work_struct *work)
|
||||||
{
|
{
|
||||||
struct super_block *sb;
|
iterate_supers(do_thaw_one, NULL);
|
||||||
char b[BDEVNAME_SIZE];
|
|
||||||
|
|
||||||
spin_lock(&sb_lock);
|
|
||||||
restart:
|
|
||||||
list_for_each_entry(sb, &super_blocks, s_list) {
|
|
||||||
sb->s_count++;
|
|
||||||
spin_unlock(&sb_lock);
|
|
||||||
down_read(&sb->s_umount);
|
|
||||||
while (sb->s_bdev && !thaw_bdev(sb->s_bdev, sb))
|
|
||||||
printk(KERN_WARNING "Emergency Thaw on %s\n",
|
|
||||||
bdevname(sb->s_bdev, b));
|
|
||||||
up_read(&sb->s_umount);
|
|
||||||
spin_lock(&sb_lock);
|
|
||||||
if (__put_super_and_need_restart(sb))
|
|
||||||
goto restart;
|
|
||||||
}
|
|
||||||
spin_unlock(&sb_lock);
|
|
||||||
kfree(work);
|
kfree(work);
|
||||||
printk(KERN_WARNING "Emergency Thaw complete\n");
|
printk(KERN_WARNING "Emergency Thaw complete\n");
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-2
@@ -844,8 +844,7 @@ retry_snap:
|
|||||||
if ((ret >= 0 || ret == -EIOCBQUEUED) &&
|
if ((ret >= 0 || ret == -EIOCBQUEUED) &&
|
||||||
((file->f_flags & O_SYNC) || IS_SYNC(file->f_mapping->host)
|
((file->f_flags & O_SYNC) || IS_SYNC(file->f_mapping->host)
|
||||||
|| ceph_osdmap_flag(osdc->osdmap, CEPH_OSDMAP_NEARFULL))) {
|
|| ceph_osdmap_flag(osdc->osdmap, CEPH_OSDMAP_NEARFULL))) {
|
||||||
err = vfs_fsync_range(file, file->f_path.dentry,
|
err = vfs_fsync_range(file, pos, pos + ret - 1, 1);
|
||||||
pos, pos + ret - 1, 1);
|
|
||||||
if (err < 0)
|
if (err < 0)
|
||||||
ret = err;
|
ret = err;
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-2
@@ -952,8 +952,7 @@ static int ceph_get_sb(struct file_system_type *fs_type,
|
|||||||
|
|
||||||
out_splat:
|
out_splat:
|
||||||
ceph_mdsc_close_sessions(&client->mdsc);
|
ceph_mdsc_close_sessions(&client->mdsc);
|
||||||
up_write(&sb->s_umount);
|
deactivate_locked_super(sb);
|
||||||
deactivate_super(sb);
|
|
||||||
goto out_final;
|
goto out_final;
|
||||||
|
|
||||||
out:
|
out:
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user