Skip to content

Commit

Permalink
Merge branch 'upstream-linus' of git://git.kernel.org/pub/scm/linux/k…
Browse files Browse the repository at this point in the history
…ernel/git/mfasheh/ocfs2

* 'upstream-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mfasheh/ocfs2: (21 commits)
  ocfs2: Check search result in ocfs2_xattr_block_get()
  ocfs2: fix printk related build warnings in xattr.c
  ocfs2: truncate outstanding block after direct io failure
  ocfs2/xattr: Proper hash collision handle in bucket division
  ocfs2: return 0 in page_mkwrite to let VFS retry.
  ocfs2: Set journal descriptor to NULL after journal shutdown
  ocfs2: Fix check of return value of ocfs2_start_trans() in xattr.c.
  ocfs2: Let inode be really deleted when ocfs2_mknod_locked() fails
  ocfs2: Fix checking of return value of new_inode()
  ocfs2: Fix check of return value of ocfs2_start_trans()
  ocfs2: Fix some typos in xattr annotations.
  ocfs2: Remove unused ocfs2_restore_xattr_block().
  ocfs2: Don't repeat ocfs2_xattr_block_find()
  ocfs2: Specify appropriate journal access for new xattr buckets.
  ocfs2: Check errors from ocfs2_xattr_update_xattr_search()
  ocfs2: Don't return -EFAULT from a corrupt xattr entry.
  ocfs2: Check xattr block signatures properly.
  ocfs2: add handler_map array bounds checking
  ocfs2: remove duplicate definition in xattr
  ocfs2: fix function declaration and definition in xattr
  ...
  • Loading branch information
torvalds committed Nov 11, 2008
2 parents 0906dd9 + 6c1e183 commit ad1164b
Show file tree
Hide file tree
Showing 9 changed files with 256 additions and 222 deletions.
27 changes: 17 additions & 10 deletions fs/ocfs2/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -247,8 +247,8 @@ int ocfs2_update_inode_atime(struct inode *inode,
mlog_entry_void();

handle = ocfs2_start_trans(osb, OCFS2_INODE_UPDATE_CREDITS);
if (handle == NULL) {
ret = -ENOMEM;
if (IS_ERR(handle)) {
ret = PTR_ERR(handle);
mlog_errno(ret);
goto out;
}
Expand Down Expand Up @@ -312,8 +312,8 @@ static int ocfs2_simple_size_update(struct inode *inode,
handle_t *handle = NULL;

handle = ocfs2_start_trans(osb, OCFS2_INODE_UPDATE_CREDITS);
if (handle == NULL) {
ret = -ENOMEM;
if (IS_ERR(handle)) {
ret = PTR_ERR(handle);
mlog_errno(ret);
goto out;
}
Expand Down Expand Up @@ -1055,8 +1055,8 @@ static int __ocfs2_write_remove_suid(struct inode *inode,
(unsigned long long)OCFS2_I(inode)->ip_blkno, inode->i_mode);

handle = ocfs2_start_trans(osb, OCFS2_INODE_UPDATE_CREDITS);
if (handle == NULL) {
ret = -ENOMEM;
if (IS_ERR(handle)) {
ret = PTR_ERR(handle);
mlog_errno(ret);
goto out;
}
Expand Down Expand Up @@ -1259,8 +1259,8 @@ static int __ocfs2_remove_inode_range(struct inode *inode,
}

handle = ocfs2_start_trans(osb, OCFS2_REMOVE_EXTENT_CREDITS);
if (handle == NULL) {
ret = -ENOMEM;
if (IS_ERR(handle)) {
ret = PTR_ERR(handle);
mlog_errno(ret);
goto out;
}
Expand Down Expand Up @@ -1352,8 +1352,8 @@ static int ocfs2_zero_partial_clusters(struct inode *inode,
goto out;

handle = ocfs2_start_trans(osb, OCFS2_INODE_UPDATE_CREDITS);
if (handle == NULL) {
ret = -ENOMEM;
if (IS_ERR(handle)) {
ret = PTR_ERR(handle);
mlog_errno(ret);
goto out;
}
Expand Down Expand Up @@ -1866,6 +1866,13 @@ static ssize_t ocfs2_file_aio_write(struct kiocb *iocb,
written = generic_file_direct_write(iocb, iov, &nr_segs, *ppos,
ppos, count, ocount);
if (written < 0) {
/*
* direct write may have instantiated a few
* blocks outside i_size. Trim these off again.
* Don't need i_size_read because we hold i_mutex.
*/
if (*ppos + count > inode->i_size)
vmtruncate(inode, inode->i_size);
ret = written;
goto out_dio;
}
Expand Down
6 changes: 6 additions & 0 deletions fs/ocfs2/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -1106,6 +1106,12 @@ void ocfs2_clear_inode(struct inode *inode)
oi->ip_last_trans = 0;
oi->ip_dir_start_lookup = 0;
oi->ip_blkno = 0ULL;

/*
* ip_jinode is used to track txns against this inode. We ensure that
* the journal is flushed before journal shutdown. Thus it is safe to
* have inodes get cleaned up after journal shutdown.
*/
jbd2_journal_release_jbd_inode(OCFS2_SB(inode->i_sb)->journal->j_journal,
&oi->ip_jinode);

Expand Down
1 change: 1 addition & 0 deletions fs/ocfs2/journal.c
Original file line number Diff line number Diff line change
Expand Up @@ -690,6 +690,7 @@ void ocfs2_journal_shutdown(struct ocfs2_super *osb)

/* Shutdown the kernel journal system */
jbd2_journal_destroy(journal->j_journal);
journal->j_journal = NULL;

OCFS2_I(inode)->ip_open_count--;

Expand Down
6 changes: 5 additions & 1 deletion fs/ocfs2/mmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,11 @@ static int __ocfs2_page_mkwrite(struct inode *inode, struct buffer_head *di_bh,
* ocfs2_write_begin_nolock().
*/
if (!PageUptodate(page) || page->mapping != inode->i_mapping) {
ret = -EINVAL;
/*
* the page has been umapped in ocfs2_data_downconvert_worker.
* So return 0 here and let VFS retry.
*/
ret = 0;
goto out;
}

Expand Down
8 changes: 5 additions & 3 deletions fs/ocfs2/namei.c
Original file line number Diff line number Diff line change
Expand Up @@ -378,8 +378,8 @@ static int ocfs2_mknod_locked(struct ocfs2_super *osb,
}

inode = new_inode(dir->i_sb);
if (IS_ERR(inode)) {
status = PTR_ERR(inode);
if (!inode) {
status = -ENOMEM;
mlog(ML_ERROR, "new_inode failed!\n");
goto leave;
}
Expand Down Expand Up @@ -491,8 +491,10 @@ static int ocfs2_mknod_locked(struct ocfs2_super *osb,
brelse(*new_fe_bh);
*new_fe_bh = NULL;
}
if (inode)
if (inode) {
clear_nlink(inode);
iput(inode);
}
}

mlog_exit(status);
Expand Down
3 changes: 3 additions & 0 deletions fs/ocfs2/ocfs2.h
Original file line number Diff line number Diff line change
Expand Up @@ -473,6 +473,9 @@ static inline int ocfs2_uses_extended_slot_map(struct ocfs2_super *osb)
(____gd)->bg_signature); \
} while (0)

#define OCFS2_IS_VALID_XATTR_BLOCK(ptr) \
(!strcmp((ptr)->xb_signature, OCFS2_XATTR_BLOCK_SIGNATURE))

static inline unsigned long ino_from_blkno(struct super_block *sb,
u64 blkno)
{
Expand Down
17 changes: 9 additions & 8 deletions fs/ocfs2/ocfs2_fs.h
Original file line number Diff line number Diff line change
Expand Up @@ -742,12 +742,12 @@ struct ocfs2_group_desc
*/
struct ocfs2_xattr_entry {
__le32 xe_name_hash; /* hash value of xattr prefix+suffix. */
__le16 xe_name_offset; /* byte offset from the 1st etnry in the local
__le16 xe_name_offset; /* byte offset from the 1st entry in the
local xattr storage(inode, xattr block or
xattr bucket). */
__u8 xe_name_len; /* xattr name len, does't include prefix. */
__u8 xe_type; /* the low 7 bits indicates the name prefix's
* type and the highest 1 bits indicate whether
__u8 xe_type; /* the low 7 bits indicate the name prefix
* type and the highest bit indicates whether
* the EA is stored in the local storage. */
__le64 xe_value_size; /* real xattr value length. */
};
Expand All @@ -766,18 +766,19 @@ struct ocfs2_xattr_header {
xattr. */
__le16 xh_name_value_len; /* total length of name/value
length in this bucket. */
__le16 xh_num_buckets; /* bucket nums in one extent
record, only valid in the
first bucket. */
__le16 xh_num_buckets; /* Number of xattr buckets
in this extent record,
only valid in the first
bucket. */
__le64 xh_csum;
struct ocfs2_xattr_entry xh_entries[0]; /* xattr entry list. */
};

/*
* On disk structure for xattr value root.
*
* It is used when one extended attribute's size is larger, and we will save it
* in an outside cluster. It will stored in a b-tree like file content.
* When an xattr's value is large enough, it is stored in an external
* b-tree like file data. The xattr value root points to this structure.
*/
struct ocfs2_xattr_value_root {
/*00*/ __le32 xr_clusters; /* clusters covered by xattr value. */
Expand Down
Loading

0 comments on commit ad1164b

Please sign in to comment.