Commit e1c50248 authored by Linus Torvalds's avatar Linus Torvalds

Merge branch 'reiserfs-updates' from Jeff Mahoney

* reiserfs-updates: (35 commits)
  reiserfs: rename [cn]_* variables
  reiserfs: rename p_._ variables
  reiserfs: rename p_s_tb to tb
  reiserfs: rename p_s_inode to inode
  reiserfs: rename p_s_bh to bh
  reiserfs: rename p_s_sb to sb
  reiserfs: strip trailing whitespace
  reiserfs: cleanup path functions
  reiserfs: factor out buffer_info initialization
  reiserfs: add atomic addition of selinux attributes during inode creation
  reiserfs: use generic readdir for operations across all xattrs
  reiserfs: journaled xattrs
  reiserfs: use generic xattr handlers
  reiserfs: remove i_has_xattr_dir
  reiserfs: make per-inode xattr locking more fine grained
  reiserfs: eliminate per-super xattr lock
  reiserfs: simplify xattr internal file lookups/opens
  reiserfs: Clean up xattrs when REISERFS_FS_XATTR is unset
  reiserfs: remove IS_PRIVATE helpers
  reiserfs: remove link detection code
  ...

Fixed up conflicts manually due to:
 - quota name cleanups vs variable naming changes:
	fs/reiserfs/inode.c
	fs/reiserfs/namei.c
	fs/reiserfs/stree.c
        fs/reiserfs/xattr.c
 - exported include header cleanups
	include/linux/reiserfs_fs.h
parents 019abbc8 ee93961b
......@@ -7,10 +7,10 @@ obj-$(CONFIG_REISERFS_FS) += reiserfs.o
reiserfs-objs := bitmap.o do_balan.o namei.o inode.o file.o dir.o fix_node.o \
super.o prints.o objectid.o lbalance.o ibalance.o stree.o \
hashes.o tail_conversion.o journal.o resize.o \
item_ops.o ioctl.o procfs.o
item_ops.o ioctl.o procfs.o xattr.o
ifeq ($(CONFIG_REISERFS_FS_XATTR),y)
reiserfs-objs += xattr.o xattr_user.o xattr_trusted.o
reiserfs-objs += xattr_user.o xattr_trusted.o
endif
ifeq ($(CONFIG_REISERFS_FS_SECURITY),y)
......
......@@ -40,7 +40,7 @@
#define SET_OPTION(optname) \
do { \
reiserfs_warning(s, "reiserfs: option \"%s\" is set", #optname); \
reiserfs_info(s, "block allocator option \"%s\" is set", #optname); \
set_bit(_ALLOC_ ## optname , &SB_ALLOC_OPTS(s)); \
} while(0)
#define TEST_OPTION(optname, s) \
......@@ -64,8 +64,8 @@ int is_reusable(struct super_block *s, b_blocknr_t block, int bit_value)
unsigned int bmap_count = reiserfs_bmap_count(s);
if (block == 0 || block >= SB_BLOCK_COUNT(s)) {
reiserfs_warning(s,
"vs-4010: is_reusable: block number is out of range %lu (%u)",
reiserfs_error(s, "vs-4010",
"block number is out of range %lu (%u)",
block, SB_BLOCK_COUNT(s));
return 0;
}
......@@ -79,30 +79,29 @@ int is_reusable(struct super_block *s, b_blocknr_t block, int bit_value)
b_blocknr_t bmap1 = REISERFS_SB(s)->s_sbh->b_blocknr + 1;
if (block >= bmap1 &&
block <= bmap1 + bmap_count) {
reiserfs_warning(s, "vs: 4019: is_reusable: "
"bitmap block %lu(%u) can't be freed or reused",
reiserfs_error(s, "vs-4019", "bitmap block %lu(%u) "
"can't be freed or reused",
block, bmap_count);
return 0;
}
} else {
if (offset == 0) {
reiserfs_warning(s, "vs: 4020: is_reusable: "
"bitmap block %lu(%u) can't be freed or reused",
reiserfs_error(s, "vs-4020", "bitmap block %lu(%u) "
"can't be freed or reused",
block, bmap_count);
return 0;
}
}
if (bmap >= bmap_count) {
reiserfs_warning(s,
"vs-4030: is_reusable: there is no so many bitmap blocks: "
"block=%lu, bitmap_nr=%u", block, bmap);
reiserfs_error(s, "vs-4030", "bitmap for requested block "
"is out of range: block=%lu, bitmap_nr=%u",
block, bmap);
return 0;
}
if (bit_value == 0 && block == SB_ROOT_BLOCK(s)) {
reiserfs_warning(s,
"vs-4050: is_reusable: this is root block (%u), "
reiserfs_error(s, "vs-4050", "this is root block (%u), "
"it must be busy", SB_ROOT_BLOCK(s));
return 0;
}
......@@ -154,8 +153,8 @@ static int scan_bitmap_block(struct reiserfs_transaction_handle *th,
/* - I mean `a window of zero bits' as in description of this function - Zam. */
if (!bi) {
reiserfs_warning(s, "NULL bitmap info pointer for bitmap %d",
bmap_n);
reiserfs_error(s, "jdm-4055", "NULL bitmap info pointer "
"for bitmap %d", bmap_n);
return 0;
}
......@@ -400,11 +399,8 @@ static void _reiserfs_free_block(struct reiserfs_transaction_handle *th,
get_bit_address(s, block, &nr, &offset);
if (nr >= reiserfs_bmap_count(s)) {
reiserfs_warning(s, "vs-4075: reiserfs_free_block: "
"block %lu is out of range on %s "
"(nr=%u,max=%u)", block,
reiserfs_bdevname(s), nr,
reiserfs_bmap_count(s));
reiserfs_error(s, "vs-4075", "block %lu is out of range",
block);
return;
}
......@@ -416,9 +412,8 @@ static void _reiserfs_free_block(struct reiserfs_transaction_handle *th,
/* clear bit for the given block in bit map */
if (!reiserfs_test_and_clear_le_bit(offset, bmbh->b_data)) {
reiserfs_warning(s, "vs-4080: reiserfs_free_block: "
"free_block (%s:%lu)[dev:blocknr]: bit already cleared",
reiserfs_bdevname(s), block);
reiserfs_error(s, "vs-4080",
"block %lu: bit already cleared", block);
}
apbi[nr].free_count++;
journal_mark_dirty(th, s, bmbh);
......@@ -445,7 +440,7 @@ void reiserfs_free_block(struct reiserfs_transaction_handle *th,
return;
if (block > sb_block_count(REISERFS_SB(s)->s_rs)) {
reiserfs_panic(th->t_super, "bitmap-4072",
reiserfs_error(th->t_super, "bitmap-4072",
"Trying to free block outside file system "
"boundaries (%lu > %lu)",
block, sb_block_count(REISERFS_SB(s)->s_rs));
......@@ -477,9 +472,8 @@ static void __discard_prealloc(struct reiserfs_transaction_handle *th,
BUG_ON(!th->t_trans_id);
#ifdef CONFIG_REISERFS_CHECK
if (ei->i_prealloc_count < 0)
reiserfs_warning(th->t_super,
"zam-4001:%s: inode has negative prealloc blocks count.",
__func__);
reiserfs_error(th->t_super, "zam-4001",
"inode has negative prealloc blocks count.");
#endif
while (ei->i_prealloc_count > 0) {
reiserfs_free_prealloc_block(th, inode, ei->i_prealloc_block);
......@@ -515,9 +509,9 @@ void reiserfs_discard_all_prealloc(struct reiserfs_transaction_handle *th)
i_prealloc_list);
#ifdef CONFIG_REISERFS_CHECK
if (!ei->i_prealloc_count) {
reiserfs_warning(th->t_super,
"zam-4001:%s: inode is in prealloc list but has no preallocated blocks.",
__func__);
reiserfs_error(th->t_super, "zam-4001",
"inode is in prealloc list but has "
"no preallocated blocks.");
}
#endif
__discard_prealloc(th, ei);
......@@ -631,12 +625,12 @@ int reiserfs_parse_alloc_options(struct super_block *s, char *options)
continue;
}
reiserfs_warning(s, "zam-4001: %s : unknown option - %s",
__func__, this_char);
reiserfs_warning(s, "zam-4001", "unknown option - %s",
this_char);
return 1;
}
reiserfs_warning(s, "allocator options = [%08x]\n", SB_ALLOC_OPTS(s));
reiserfs_info(s, "allocator options = [%08x]\n", SB_ALLOC_OPTS(s));
return 0;
}
......@@ -1221,7 +1215,9 @@ void reiserfs_cache_bitmap_metadata(struct super_block *sb,
unsigned long *cur = (unsigned long *)(bh->b_data + bh->b_size);
/* The first bit must ALWAYS be 1 */
BUG_ON(!reiserfs_test_le_bit(0, (unsigned long *)bh->b_data));
if (!reiserfs_test_le_bit(0, (unsigned long *)bh->b_data))
reiserfs_error(sb, "reiserfs-2025", "bitmap block %lu is "
"corrupted: first bit must be 1", bh->b_blocknr);
info->free_count = 0;
......
......@@ -41,10 +41,10 @@ static int reiserfs_dir_fsync(struct file *filp, struct dentry *dentry,
#define store_ih(where,what) copy_item_head (where, what)
//
static int reiserfs_readdir(struct file *filp, void *dirent, filldir_t filldir)
int reiserfs_readdir_dentry(struct dentry *dentry, void *dirent,
filldir_t filldir, loff_t *pos)
{
struct inode *inode = filp->f_path.dentry->d_inode;
struct inode *inode = dentry->d_inode;
struct cpu_key pos_key; /* key of current position in the directory (key of directory entry) */
INITIALIZE_PATH(path_to_entry);
struct buffer_head *bh;
......@@ -64,13 +64,9 @@ static int reiserfs_readdir(struct file *filp, void *dirent, filldir_t filldir)
/* form key for search the next directory entry using f_pos field of
file structure */
make_cpu_key(&pos_key, inode,
(filp->f_pos) ? (filp->f_pos) : DOT_OFFSET, TYPE_DIRENTRY,
3);
make_cpu_key(&pos_key, inode, *pos ?: DOT_OFFSET, TYPE_DIRENTRY, 3);
next_pos = cpu_key_k_offset(&pos_key);
/* reiserfs_warning (inode->i_sb, "reiserfs_readdir 1: f_pos = %Ld", filp->f_pos); */
path_to_entry.reada = PATH_READA;
while (1) {
research:
......@@ -144,7 +140,7 @@ static int reiserfs_readdir(struct file *filp, void *dirent, filldir_t filldir)
/* Ignore the .reiserfs_priv entry */
if (reiserfs_xattrs(inode->i_sb) &&
!old_format_only(inode->i_sb) &&
filp->f_path.dentry == inode->i_sb->s_root &&
dentry == inode->i_sb->s_root &&
REISERFS_SB(inode->i_sb)->priv_root &&
REISERFS_SB(inode->i_sb)->priv_root->d_inode
&& deh_objectid(deh) ==
......@@ -156,7 +152,7 @@ static int reiserfs_readdir(struct file *filp, void *dirent, filldir_t filldir)
}
d_off = deh_offset(deh);
filp->f_pos = d_off;
*pos = d_off;
d_ino = deh_objectid(deh);
if (d_reclen <= 32) {
local_buf = small_buf;
......@@ -223,15 +219,21 @@ static int reiserfs_readdir(struct file *filp, void *dirent, filldir_t filldir)
} /* while */
end:
filp->f_pos = next_pos;
end:
*pos = next_pos;
pathrelse(&path_to_entry);
reiserfs_check_path(&path_to_entry);
out:
out:
reiserfs_write_unlock(inode->i_sb);
return ret;
}
static int reiserfs_readdir(struct file *file, void *dirent, filldir_t filldir)
{
struct dentry *dentry = file->f_path.dentry;
return reiserfs_readdir_dentry(dentry, dirent, filldir, &file->f_pos);
}
/* compose directory item containing "." and ".." entries (entries are
not aligned to 4 byte boundary) */
/* the last four params are LE */
......
This diff is collapsed.
......@@ -76,7 +76,7 @@ static int reiserfs_file_release(struct inode *inode, struct file *filp)
* and let the admin know what is going on.
*/
igrab(inode);
reiserfs_warning(inode->i_sb,
reiserfs_warning(inode->i_sb, "clm-9001",
"pinning inode %lu because the "
"preallocation can't be freed",
inode->i_ino);
......@@ -134,23 +134,23 @@ static void reiserfs_vfs_truncate_file(struct inode *inode)
* be removed...
*/
static int reiserfs_sync_file(struct file *p_s_filp,
struct dentry *p_s_dentry, int datasync)
static int reiserfs_sync_file(struct file *filp,
struct dentry *dentry, int datasync)
{
struct inode *p_s_inode = p_s_dentry->d_inode;
int n_err;
struct inode *inode = dentry->d_inode;
int err;
int barrier_done;
BUG_ON(!S_ISREG(p_s_inode->i_mode));
n_err = sync_mapping_buffers(p_s_inode->i_mapping);
reiserfs_write_lock(p_s_inode->i_sb);
barrier_done = reiserfs_commit_for_inode(p_s_inode);
reiserfs_write_unlock(p_s_inode->i_sb);
if (barrier_done != 1 && reiserfs_barrier_flush(p_s_inode->i_sb))
blkdev_issue_flush(p_s_inode->i_sb->s_bdev, NULL);
BUG_ON(!S_ISREG(inode->i_mode));
err = sync_mapping_buffers(inode->i_mapping);
reiserfs_write_lock(inode->i_sb);
barrier_done = reiserfs_commit_for_inode(inode);
reiserfs_write_unlock(inode->i_sb);
if (barrier_done != 1 && reiserfs_barrier_flush(inode->i_sb))
blkdev_issue_flush(inode->i_sb->s_bdev, NULL);
if (barrier_done < 0)
return barrier_done;
return (n_err < 0) ? -EIO : 0;
return (err < 0) ? -EIO : 0;
}
/* taken fs/buffer.c:__block_commit_write */
......
This diff is collapsed.
......@@ -105,8 +105,8 @@ static void internal_define_dest_src_infos(int shift_mode,
break;
default:
reiserfs_panic(tb->tb_sb,
"internal_define_dest_src_infos: shift type is unknown (%d)",
reiserfs_panic(tb->tb_sb, "ibalance-1",
"shift type is unknown (%d)",
shift_mode);
}
}
......@@ -702,8 +702,8 @@ static void balance_internal_when_delete(struct tree_balance *tb,
return;
}
reiserfs_panic(tb->tb_sb,
"balance_internal_when_delete: unexpected tb->lnum[%d]==%d or tb->rnum[%d]==%d",
reiserfs_panic(tb->tb_sb, "ibalance-2",
"unexpected tb->lnum[%d]==%d or tb->rnum[%d]==%d",
h, tb->lnum[h], h, tb->rnum[h]);
}
......@@ -940,8 +940,8 @@ int balance_internal(struct tree_balance *tb, /* tree_balance structure
struct block_head *blkh;
if (tb->blknum[h] != 1)
reiserfs_panic(NULL,
"balance_internal: One new node required for creating the new root");
reiserfs_panic(NULL, "ibalance-3", "One new node "
"required for creating the new root");
/* S[h] = empty buffer from the list FEB. */
tbSh = get_FEB(tb);
blkh = B_BLK_HEAD(tbSh);
......
This diff is collapsed.
......@@ -97,7 +97,8 @@ static int sd_unit_num(struct virtual_item *vi)
static void sd_print_vi(struct virtual_item *vi)
{
reiserfs_warning(NULL, "STATDATA, index %d, type 0x%x, %h",
reiserfs_warning(NULL, "reiserfs-16100",
"STATDATA, index %d, type 0x%x, %h",
vi->vi_index, vi->vi_type, vi->vi_ih);
}
......@@ -190,7 +191,8 @@ static int direct_unit_num(struct virtual_item *vi)
static void direct_print_vi(struct virtual_item *vi)
{
reiserfs_warning(NULL, "DIRECT, index %d, type 0x%x, %h",
reiserfs_warning(NULL, "reiserfs-16101",
"DIRECT, index %d, type 0x%x, %h",
vi->vi_index, vi->vi_type, vi->vi_ih);
}
......@@ -278,7 +280,7 @@ static void indirect_print_item(struct item_head *ih, char *item)
unp = (__le32 *) item;
if (ih_item_len(ih) % UNFM_P_SIZE)
reiserfs_warning(NULL, "indirect_print_item: invalid item len");
reiserfs_warning(NULL, "reiserfs-16102", "invalid item len");
printk("%d pointers\n[ ", (int)I_UNFM_NUM(ih));
for (j = 0; j < I_UNFM_NUM(ih); j++) {
......@@ -334,7 +336,8 @@ static int indirect_unit_num(struct virtual_item *vi)
static void indirect_print_vi(struct virtual_item *vi)
{
reiserfs_warning(NULL, "INDIRECT, index %d, type 0x%x, %h",
reiserfs_warning(NULL, "reiserfs-16103",
"INDIRECT, index %d, type 0x%x, %h",
vi->vi_index, vi->vi_type, vi->vi_ih);
}
......@@ -359,7 +362,7 @@ static struct item_operations indirect_ops = {
static int direntry_bytes_number(struct item_head *ih, int block_size)
{
reiserfs_warning(NULL, "vs-16090: direntry_bytes_number: "
reiserfs_warning(NULL, "vs-16090",
"bytes number is asked for direntry");
return 0;
}
......@@ -514,8 +517,9 @@ static int direntry_create_vi(struct virtual_node *vn,
((is_affected
&& (vn->vn_mode == M_PASTE
|| vn->vn_mode == M_CUT)) ? insert_size : 0)) {
reiserfs_panic(NULL,
"vs-8025: set_entry_sizes: (mode==%c, insert_size==%d), invalid length of directory item",
reiserfs_panic(NULL, "vs-8025", "(mode==%c, "
"insert_size==%d), invalid length of "
"directory item",
vn->vn_mode, insert_size);
}
}
......@@ -546,7 +550,8 @@ static int direntry_check_left(struct virtual_item *vi, int free,
}
if (entries == dir_u->entry_count) {
reiserfs_panic(NULL, "free space %d, entry_count %d\n", free,
reiserfs_panic(NULL, "item_ops-1",
"free space %d, entry_count %d", free,
dir_u->entry_count);
}
......@@ -614,7 +619,8 @@ static void direntry_print_vi(struct virtual_item *vi)
int i;
struct direntry_uarea *dir_u = vi->vi_uarea;
reiserfs_warning(NULL, "DIRENTRY, index %d, type 0x%x, %h, flags 0x%x",
reiserfs_warning(NULL, "reiserfs-16104",
"DIRENTRY, index %d, type 0x%x, %h, flags 0x%x",
vi->vi_index, vi->vi_type, vi->vi_ih, dir_u->flags);
printk("%d entries: ", dir_u->entry_count);
for (i = 0; i < dir_u->entry_count; i++)
......@@ -642,43 +648,43 @@ static struct item_operations direntry_ops = {
//
static int errcatch_bytes_number(struct item_head *ih, int block_size)
{
reiserfs_warning(NULL,
"green-16001: Invalid item type observed, run fsck ASAP");
reiserfs_warning(NULL, "green-16001",
"Invalid item type observed, run fsck ASAP");
return 0;
}
static void errcatch_decrement_key(struct cpu_key *key)
{
reiserfs_warning(NULL,
"green-16002: Invalid item type observed, run fsck ASAP");
reiserfs_warning(NULL, "green-16002",
"Invalid item type observed, run fsck ASAP");
}
static int errcatch_is_left_mergeable(struct reiserfs_key *key,
unsigned long bsize)
{
reiserfs_warning(NULL,
"green-16003: Invalid item type observed, run fsck ASAP");
reiserfs_warning(NULL, "green-16003",
"Invalid item type observed, run fsck ASAP");
return 0;
}
static void errcatch_print_item(struct item_head *ih, char *item)
{
reiserfs_warning(NULL,
"green-16004: Invalid item type observed, run fsck ASAP");
reiserfs_warning(NULL, "green-16004",
"Invalid item type observed, run fsck ASAP");
}
static void errcatch_check_item(struct item_head *ih, char *item)
{
reiserfs_warning(NULL,
"green-16005: Invalid item type observed, run fsck ASAP");
reiserfs_warning(NULL, "green-16005",
"Invalid item type observed, run fsck ASAP");
}
static int errcatch_create_vi(struct virtual_node *vn,
struct virtual_item *vi,
int is_affected, int insert_size)
{
reiserfs_warning(NULL,
"green-16006: Invalid item type observed, run fsck ASAP");
reiserfs_warning(NULL, "green-16006",
"Invalid item type observed, run fsck ASAP");
return 0; // We might return -1 here as well, but it won't help as create_virtual_node() from where
// this operation is called from is of return type void.
}
......@@ -686,36 +692,36 @@ static int errcatch_create_vi(struct virtual_node *vn,
static int errcatch_check_left(struct virtual_item *vi, int free,
int start_skip, int end_skip)
{
reiserfs_warning(NULL,
"green-16007: Invalid item type observed, run fsck ASAP");
reiserfs_warning(NULL, "green-16007",
"Invalid item type observed, run fsck ASAP");
return -1;
}
static int errcatch_check_right(struct virtual_item *vi, int free)
{
reiserfs_warning(NULL,
"green-16008: Invalid item type observed, run fsck ASAP");
reiserfs_warning(NULL, "green-16008",
"Invalid item type observed, run fsck ASAP");
return -1;
}
static int errcatch_part_size(struct virtual_item *vi, int first, int count)
{
reiserfs_warning(NULL,
"green-16009: Invalid item type observed, run fsck ASAP");
reiserfs_warning(NULL, "green-16009",
"Invalid item type observed, run fsck ASAP");
return 0;
}
static int errcatch_unit_num(struct virtual_item *vi)
{
reiserfs_warning(NULL,
"green-16010: Invalid item type observed, run fsck ASAP");
reiserfs_warning(NULL, "green-16010",
"Invalid item type observed, run fsck ASAP");
return 0;
}
static void errcatch_print_vi(struct virtual_item *vi)
{
reiserfs_warning(NULL,
"green-16011: Invalid item type observed, run fsck ASAP");
reiserfs_warning(NULL, "green-16011",
"Invalid item type observed, run fsck ASAP");
}
static struct item_operations errcatch_ops = {
......
This diff is collapsed.
......@@ -111,7 +111,7 @@ static void leaf_copy_dir_entries(struct buffer_info *dest_bi,
item_num_in_dest =
(last_first == FIRST_TO_LAST) ? (B_NR_ITEMS(dest) - 1) : 0;
leaf_paste_entries(dest_bi->bi_bh, item_num_in_dest,
leaf_paste_entries(dest_bi, item_num_in_dest,
(last_first ==
FIRST_TO_LAST) ? I_ENTRY_COUNT(B_N_PITEM_HEAD(dest,
item_num_in_dest))
......@@ -168,10 +168,11 @@ static int leaf_copy_boundary_item(struct buffer_info *dest_bi,
if (bytes_or_entries == ih_item_len(ih)
&& is_indirect_le_ih(ih))
if (get_ih_free_space(ih))
reiserfs_panic(NULL,
"vs-10020: leaf_copy_boundary_item: "
"last unformatted node must be filled entirely (%h)",
ih);
reiserfs_panic(sb_from_bi(dest_bi),
"vs-10020",
"last unformatted node "
"must be filled "
"entirely (%h)", ih);
}
#endif
......@@ -622,9 +623,8 @@ static void leaf_define_dest_src_infos(int shift_mode, struct tree_balance *tb,
break;
default:
reiserfs_panic(NULL,
"vs-10250: leaf_define_dest_src_infos: shift type is unknown (%d)",
shift_mode);
reiserfs_panic(sb_from_bi(src_bi), "vs-10250",
"shift type is unknown (%d)", shift_mode);
}
RFALSE(!src_bi->bi_bh || !dest_bi->bi_bh,
"vs-10260: mode==%d, source (%p) or dest (%p) buffer is initialized incorrectly",
......@@ -674,9 +674,9 @@ int leaf_shift_left(struct tree_balance *tb, int shift_num, int shift_bytes)
#ifdef CONFIG_REISERFS_CHECK
if (tb->tb_mode == M_PASTE || tb->tb_mode == M_INSERT) {
print_cur_tb("vs-10275");
reiserfs_panic(tb->tb_sb,
"vs-10275: leaf_shift_left: balance condition corrupted (%c)",
tb->tb_mode);
reiserfs_panic(tb->tb_sb, "vs-10275",
"balance condition corrupted "
"(%c)", tb->tb_mode);
}
#endif
......@@ -889,9 +889,12 @@ void leaf_paste_in_buffer(struct buffer_info *bi, int affected_item_num,
#ifdef CONFIG_REISERFS_CHECK
if (zeros_number > paste_size) {
struct super_block *sb = NULL;
if (bi && bi->tb)
sb = bi->tb->tb_sb;
print_cur_tb("10177");
reiserfs_panic(NULL,
"vs-10177: leaf_paste_in_buffer: ero number == %d, paste_size == %d",
reiserfs_panic(sb, "vs-10177",
"zeros_number == %d, paste_size == %d",
zeros_number, paste_size);
}
#endif /* CONFIG_REISERFS_CHECK */
......@@ -1191,7 +1194,7 @@ static void leaf_delete_items_entirely(struct buffer_info *bi,
}
/* paste new_entry_count entries (new_dehs, records) into position before to item_num-th item */
void leaf_paste_entries(struct buffer_head *bh,
void leaf_paste_entries(struct buffer_info *bi,
int item_num,
int before,
int new_entry_count,
......@@ -1203,6 +1206,7 @@ void leaf_paste_entries(struct buffer_head *bh,
struct reiserfs_de_head *deh;
char *insert_point;
int i, old_entry_num;
struct buffer_head *bh = bi->bi_bh;
if (new_entry_count == 0)
return;
......@@ -1287,12 +1291,16 @@ void leaf_paste_entries(struct buffer_head *bh,
prev = (i != 0) ? deh_location(&(deh[i - 1])) : 0;
if (prev && prev <= deh_location(&(deh[i])))
reiserfs_warning(NULL,
"vs-10240: leaf_paste_entries: directory item (%h) corrupted (prev %a, cur(%d) %a)",
reiserfs_error(sb_from_bi(bi), "vs-10240",
"directory item (%h) "
"corrupted (prev %a, "
"cur(%d) %a)",
ih, deh + i - 1, i, deh + i);
if (next && next >= deh_location(&(deh[i])))
reiserfs_warning(NULL,
"vs-10250: leaf_paste_entries: directory item (%h) corrupted (cur(%d) %a, next %a)",
reiserfs_error(sb_from_bi(bi), "vs-10250",
"directory item (%h) "
"corrupted (cur(%d) %a, "
"next %a)",
ih, i, deh + i, deh + i + 1);
}
}
......
This diff is collapsed.
......@@ -18,8 +18,7 @@
static void check_objectid_map(struct super_block *s, __le32 * map)
{
if (le32_to_cpu(map[0]) != 1)
reiserfs_panic(s,
"vs-15010: check_objectid_map: map corrupted: %lx",
reiserfs_panic(s, "vs-15010", "map corrupted: %lx",
(long unsigned int)le32_to_cpu(map[0]));
// FIXME: add something else here
......@@ -61,7 +60,7 @@ __u32 reiserfs_get_unused_objectid(struct reiserfs_transaction_handle *th)
/* comment needed -Hans */
unused_objectid = le32_to_cpu(map[1]);
if (unused_objectid == U32_MAX) {
reiserfs_warning(s, "%s: no more object ids", __func__);
reiserfs_warning(s, "reiserfs-15100", "no more object ids");
reiserfs_restore_prepared_buffer(s, SB_BUFFER_WITH_SB(s));
return 0;
}
......@@ -160,8 +159,7 @@ void reiserfs_release_objectid(struct reiserfs_transaction_handle *th,
i += 2;
}
reiserfs_warning(s,
"vs-15011: reiserfs_release_objectid: tried to free free object id (%lu)",
reiserfs_error(s, "vs-15011", "tried to free free object id (%lu)",
(long unsigned)objectid_to_release);
}
......
......@@ -157,19 +157,16 @@ static void sprintf_disk_child(char *buf, struct disk_child *dc)
dc_size(dc));
}
static char *is_there_reiserfs_struct(char *fmt, int *what, int *skip)
static char *is_there_reiserfs_struct(char *fmt, int *what)
{
char *k = fmt;
*skip = 0;
while ((k = strchr(k, '%')) != NULL) {
if (k[1] == 'k' || k[1] == 'K' || k[1] == 'h' || k[1] == 't' ||
k[1] == 'z' || k[1] == 'b' || k[1] == 'y' || k[1] == 'a') {
*what = k[1];
break;
}
(*skip)++;
k++;
}
return k;
......@@ -187,24 +184,23 @@ static char *is_there_reiserfs_struct(char *fmt, int *what, int *skip)
printk ("bad key %lu %lu %lu %lu", key->k_dir_id, key->k_objectid,
key->k_offset, key->k_uniqueness);
*/
static DEFINE_SPINLOCK(error_lock);
static void prepare_error_buf(const char *fmt, va_list args)
{
char *fmt1 = fmt_buf;
char *k;
char *p = error_buf;
int i, j, what, skip;
int what;
spin_lock(&error_lock);
strcpy(fmt1, fmt);
while ((k = is_there_reiserfs_struct(fmt1, &what, &skip)) != NULL) {
while ((k = is_there_reiserfs_struct(fmt1, &what)) != NULL) {
*k = 0;
p += vsprintf(p, fmt1, args);
for (i = 0; i < skip; i++)
j = va_arg(args, int);
switch (what) {
case 'k':
sprintf_le_key(p, va_arg(args, struct reiserfs_key *));
......@@ -243,6 +239,7 @@ static void prepare_error_buf(const char *fmt, va_list args)
fmt1 = k + 2;
}
vsprintf(p, fmt1, args);
spin_unlock(&error_lock);
}
......@@ -264,14 +261,17 @@ static void prepare_error_buf(const char *fmt, va_list args)
va_end( args );\
}
void reiserfs_warning(struct super_block *sb, const char *fmt, ...)
void __reiserfs_warning(struct super_block *sb, const char *id,
const char *function, const char *fmt, ...)
{
do_reiserfs_warning(fmt);
if (sb)
printk(KERN_WARNING "ReiserFS: %s: warning: %s\n",
reiserfs_bdevname(sb), error_buf);
printk(KERN_WARNING "REISERFS warning (device %s): %s%s%s: "
"%s\n", sb->s_id, id ? id : "", id ? " " : "",
function, error_buf);
else
printk(KERN_WARNING "ReiserFS: warning: %s\n", error_buf);
printk(KERN_WARNING "REISERFS warning: %s%s%s: %s\n",
id ? id : "", id ? " " : "", function, error_buf);
}
/* No newline.. reiserfs_info calls can be followed by printk's */
......@@ -279,10 +279,10 @@ void reiserfs_info(struct super_block *sb, const char *fmt, ...)
{
do_reiserfs_warning(fmt);
if (sb)
printk(KERN_NOTICE "ReiserFS: %s: %s",
reiserfs_bdevname(sb), error_buf);
printk(KERN_NOTICE "REISERFS (device %s): %s",
sb->s_id, error_buf);
else
printk(KERN_NOTICE "ReiserFS: %s", error_buf);
printk(KERN_NOTICE "REISERFS %s:", error_buf);
}
/* No newline.. reiserfs_printk calls can be followed by printk's */
......@@ -297,10 +297,10 @@ void reiserfs_debug(struct super_block *s, int level, const char *fmt, ...)
#ifdef CONFIG_REISERFS_CHECK
do_reiserfs_warning(fmt);
if (s)
printk(KERN_DEBUG "ReiserFS: %s: %s\n",
reiserfs_bdevname(s), error_buf);
printk(KERN_DEBUG "REISERFS debug (device %s): %s\n",
s->s_id, error_buf);
else
printk(KERN_DEBUG "ReiserFS: %s\n", error_buf);
printk(KERN_DEBUG "REISERFS debug: %s\n", error_buf);
#endif
}
......@@ -353,14 +353,46 @@ void reiserfs_debug(struct super_block *s, int level, const char *fmt, ...)
extern struct tree_balance *cur_tb;
#endif
void reiserfs_panic(struct super_block *sb, const char *fmt, ...)
void __reiserfs_panic(struct super_block *sb, const char *id,
const char *function, const char *fmt, ...)
{
do_reiserfs_warning(fmt);
#ifdef CONFIG_REISERFS_CHECK
dump_stack();
#endif
if (sb)
panic(KERN_WARNING "REISERFS panic (device %s): %s%s%s: %s\n",
sb->s_id, id ? id : "", id ? " " : "",
function, error_buf);
else
panic(KERN_WARNING "REISERFS panic: %s%s%s: %s\n",
id ? id : "", id ? " " : "", function, error_buf);
}
void __reiserfs_error(struct super_block *sb, const char *id,
const char *function, const char *fmt, ...)
{
do_reiserfs_warning(fmt);
panic(KERN_EMERG "REISERFS: panic (device %s): %s\n",
reiserfs_bdevname(sb), error_buf);
BUG_ON(sb == NULL);
if (reiserfs_error_panic(sb))
__reiserfs_panic(sb, id, function, error_buf);
if (id && id[0])
printk(KERN_CRIT "REISERFS error (device %s): %s %s: %s\n",
sb->s_id, id, function, error_buf);
else
printk(KERN_CRIT "REISERFS error (device %s): %s: %s\n",
sb->s_id, function, error_buf);
if (sb->s_flags & MS_RDONLY)
return;
reiserfs_info(sb, "Remounting filesystem read-only\n");
sb->s_flags |= MS_RDONLY;
reiserfs_abort_journal(sb, -EIO);
}
void reiserfs_abort(struct super_block *sb, int errno, const char *fmt, ...)
......@@ -368,18 +400,18 @@ void reiserfs_abort(struct super_block *sb, int errno, const char *fmt, ...)
do_reiserfs_warning(fmt);
if (reiserfs_error_panic(sb)) {
panic(KERN_CRIT "REISERFS: panic (device %s): %s\n",
reiserfs_bdevname(sb), error_buf);
panic(KERN_CRIT "REISERFS panic (device %s): %s\n", sb->s_id,
error_buf);
}
if (sb->s_flags & MS_RDONLY)
if (reiserfs_is_journal_aborted(SB_JOURNAL(sb)))
return;
printk(KERN_CRIT "REISERFS: abort (device %s): %s\n",
reiserfs_bdevname(sb), error_buf);
printk(KERN_CRIT "REISERFS abort (device %s): %s\n", sb->s_id,
error_buf);
sb->s_flags |= MS_RDONLY;
reiserfs_journal_abort(sb, errno);
reiserfs_abort_journal(sb, errno);
}
/* this prints internal nodes (4 keys/items in line) (dc_number,
......@@ -681,12 +713,10 @@ static void check_leaf_block_head(struct buffer_head *bh)
blkh = B_BLK_HEAD(bh);
nr = blkh_nr_item(blkh);
if (nr > (bh->b_size - BLKH_SIZE) / IH_SIZE)
reiserfs_panic(NULL,
"vs-6010: check_leaf_block_head: invalid item number %z",
reiserfs_panic(NULL, "vs-6010", "invalid item number %z",
bh);
if (blkh_free_space(blkh) > bh->b_size - BLKH_SIZE - IH_SIZE * nr)
reiserfs_panic(NULL,
"vs-6020: check_leaf_block_head: invalid free space %z",
reiserfs_panic(NULL, "vs-6020", "invalid free space %z",
bh);
}
......@@ -697,21 +727,15 @@ static void check_internal_block_head(struct buffer_head *bh)
blkh = B_BLK_HEAD(bh);
if (!(B_LEVEL(bh) > DISK_LEAF_NODE_LEVEL && B_LEVEL(bh) <= MAX_HEIGHT))
reiserfs_panic(NULL,
"vs-6025: check_internal_block_head: invalid level %z",
bh);
reiserfs_panic(NULL, "vs-6025", "invalid level %z", bh);
if (B_NR_ITEMS(bh) > (bh->b_size - BLKH_SIZE) / IH_SIZE)
reiserfs_panic(NULL,
"vs-6030: check_internal_block_head: invalid item number %z",
bh);
reiserfs_panic(NULL, "vs-6030", "invalid item number %z", bh);
if (B_FREE_SPACE(bh) !=
bh->b_size - BLKH_SIZE - KEY_SIZE * B_NR_ITEMS(bh) -
DC_SIZE * (B_NR_ITEMS(bh) + 1))
reiserfs_panic(NULL,
"vs-6040: check_internal_block_head: invalid free space %z",
bh);
reiserfs_panic(NULL, "vs-6040", "invalid free space %z", bh);
}
......
......@@ -321,7 +321,7 @@ static int show_journal(struct seq_file *m, struct super_block *sb)
/* incore fields */
"j_1st_reserved_block: \t%i\n"
"j_state: \t%li\n"
"j_trans_id: \t%lu\n"
"j_trans_id: \t%u\n"
"j_mount_id: \t%lu\n"
"j_start: \t%lu\n"
"j_len: \t%lu\n"
......@@ -329,7 +329,7 @@ static int show_journal(struct seq_file *m, struct super_block *sb)
"j_wcount: \t%i\n"
"j_bcount: \t%lu\n"
"j_first_unflushed_offset: \t%lu\n"
"j_last_flush_trans_id: \t%lu\n"
"j_last_flush_trans_id: \t%u\n"
"j_trans_start_time: \t%li\n"
"j_list_bitmap_index: \t%i\n"
"j_must_wait: \t%i\n"
......@@ -503,7 +503,7 @@ int reiserfs_proc_info_init(struct super_block *sb)
add_file(sb, "journal", show_journal);
return 0;
}
reiserfs_warning(sb, "reiserfs: cannot create /proc/%s/%s",
reiserfs_warning(sb, "cannot create /proc/%s/%s",
proc_info_root_name, b);
return 1;
}
......@@ -559,8 +559,7 @@ int reiserfs_proc_info_global_init(void)
if (proc_info_root) {
proc_info_root->owner = THIS_MODULE;
} else {
reiserfs_warning(NULL,
"reiserfs: cannot create /proc/%s",
reiserfs_warning(NULL, "cannot create /proc/%s",
proc_info_root_name);
return 1;
}
......
This diff is collapsed.
This diff is collapsed.
......@@ -26,7 +26,7 @@ int direct2indirect(struct reiserfs_transaction_handle *th, struct inode *inode,
converted item. */
struct item_head ind_ih; /* new indirect item to be inserted or
key of unfm pointer to be pasted */
int n_blk_size, n_retval; /* returned value for reiserfs_insert_item and clones */
int blk_size, retval; /* returned value for reiserfs_insert_item and clones */
unp_t unfm_ptr; /* Handle on an unformatted node
that will be inserted in the
tree. */
......@@ -35,7 +35,7 @@ int direct2indirect(struct reiserfs_transaction_handle *th, struct inode *inode,
REISERFS_SB(sb)->s_direct2indirect++;
n_blk_size = sb->s_blocksize;
blk_size = sb->s_blocksize;
/* and key to search for append or insert pointer to the new
unformatted node. */
......@@ -46,11 +46,11 @@ int direct2indirect(struct reiserfs_transaction_handle *th, struct inode *inode,
/* Set the key to search for the place for new unfm pointer */
make_cpu_key(&end_key, inode, tail_offset, TYPE_INDIRECT, 4);
// FIXME: we could avoid this
/* FIXME: we could avoid this */
if (search_for_position_by_key(sb, &end_key, path) == POSITION_FOUND) {
reiserfs_warning(sb, "PAP-14030: direct2indirect: "
"pasted or inserted byte exists in the tree %K. "
"Use fsck to repair.", &end_key);
reiserfs_error(sb, "PAP-14030",
"pasted or inserted byte exists in "
"the tree %K. Use fsck to repair.", &end_key);
pathrelse(path);
return -EIO;
}
......@@ -64,17 +64,17 @@ int direct2indirect(struct reiserfs_transaction_handle *th, struct inode *inode,
set_ih_free_space(&ind_ih, 0); /* delete at nearest future */
put_ih_item_len(&ind_ih, UNFM_P_SIZE);
PATH_LAST_POSITION(path)++;
n_retval =
retval =
reiserfs_insert_item(th, path, &end_key, &ind_ih, inode,
(char *)&unfm_ptr);
} else {
/* Paste into last indirect item of an object. */
n_retval = reiserfs_paste_into_item(th, path, &end_key, inode,
retval = reiserfs_paste_into_item(th, path, &end_key, inode,
(char *)&unfm_ptr,
UNFM_P_SIZE);
}
if (n_retval) {
return n_retval;
if (retval) {
return retval;
}
// note: from here there are two keys which have matching first
// three key components. They only differ by the fourth one.
......@@ -92,14 +92,13 @@ int direct2indirect(struct reiserfs_transaction_handle *th, struct inode *inode,
last item of the file */
if (search_for_position_by_key(sb, &end_key, path) ==
POSITION_FOUND)
reiserfs_panic(sb,
"PAP-14050: direct2indirect: "
reiserfs_panic(sb, "PAP-14050",
"direct item (%K) not found", &end_key);
p_le_ih = PATH_PITEM_HEAD(path);
RFALSE(!is_direct_le_ih(p_le_ih),
"vs-14055: direct item expected(%K), found %h",
&end_key, p_le_ih);
tail_size = (le_ih_k_offset(p_le_ih) & (n_blk_size - 1))
tail_size = (le_ih_k_offset(p_le_ih) & (blk_size - 1))
+ ih_item_len(p_le_ih) - 1;
/* we only send the unbh pointer if the buffer is not up to date.
......@@ -114,11 +113,11 @@ int direct2indirect(struct reiserfs_transaction_handle *th, struct inode *inode,
} else {
up_to_date_bh = unbh;
}
n_retval = reiserfs_delete_item(th, path, &end_key, inode,
retval = reiserfs_delete_item(th, path, &end_key, inode,
up_to_date_bh);
total_tail += n_retval;
if (tail_size == n_retval)
total_tail += retval;
if (tail_size == retval)
// done: file does not have direct items anymore
break;
......@@ -130,7 +129,7 @@ int direct2indirect(struct reiserfs_transaction_handle *th, struct inode *inode,
unsigned pgoff =
(tail_offset + total_tail - 1) & (PAGE_CACHE_SIZE - 1);
char *kaddr = kmap_atomic(up_to_date_bh->b_page, KM_USER0);
memset(kaddr + pgoff, 0, n_blk_size - total_tail);
memset(kaddr + pgoff, 0, blk_size - total_tail);
kunmap_atomic(kaddr, KM_USER0);
}
......@@ -171,14 +170,18 @@ void reiserfs_unmap_buffer(struct buffer_head *bh)
what we expect from it (number of cut bytes). But when tail remains
in the unformatted node, we set mode to SKIP_BALANCING and unlock
inode */
int indirect2direct(struct reiserfs_transaction_handle *th, struct inode *p_s_inode, struct page *page, struct treepath *p_s_path, /* path to the indirect item. */
const struct cpu_key *p_s_item_key, /* Key to look for unformatted node pointer to be cut. */
int indirect2direct(struct reiserfs_transaction_handle *th,
struct inode *inode, struct page *page,
struct treepath *path, /* path to the indirect item. */
const struct cpu_key *item_key, /* Key to look for
* unformatted node
* pointer to be cut. */
loff_t n_new_file_size, /* New file size. */
char *p_c_mode)
char *mode)
{
struct super_block *p_s_sb = p_s_inode->i_sb;
struct super_block *sb = inode->i_sb;
struct item_head s_ih;
unsigned long n_block_size = p_s_sb->s_blocksize;
unsigned long block_size = sb->s_blocksize;
char *tail;
int tail_len, round_tail_len;
loff_t pos, pos1; /* position of first byte of the tail */
......@@ -186,22 +189,22 @@ int indirect2direct(struct reiserfs_transaction_handle *th, struct inode *p_s_in
BUG_ON(!th->t_trans_id);
REISERFS_SB(p_s_sb)->s_indirect2direct++;
REISERFS_SB(sb)->s_indirect2direct++;
*p_c_mode = M_SKIP_BALANCING;
*mode = M_SKIP_BALANCING;
/* store item head path points to. */
copy_item_head(&s_ih, PATH_PITEM_HEAD(p_s_path));
copy_item_head(&s_ih, PATH_PITEM_HEAD(path));
tail_len = (n_new_file_size & (n_block_size - 1));
if (get_inode_sd_version(p_s_inode) == STAT_DATA_V2)
tail_len = (n_new_file_size & (block_size - 1));
if (get_inode_sd_version(inode) == STAT_DATA_V2)
round_tail_len = ROUND_UP(tail_len);
else
round_tail_len = tail_len;
pos =
le_ih_k_offset(&s_ih) - 1 + (ih_item_len(&s_ih) / UNFM_P_SIZE -
1) * p_s_sb->s_blocksize;
1) * sb->s_blocksize;
pos1 = pos;
// we are protected by i_mutex. The tail can not disapper, not
......@@ -210,27 +213,26 @@ int indirect2direct(struct reiserfs_transaction_handle *th, struct inode *p_s_in
tail = (char *)kmap(page); /* this can schedule */
if (path_changed(&s_ih, p_s_path)) {
if (path_changed(&s_ih, path)) {
/* re-search indirect item */
if (search_for_position_by_key(p_s_sb, p_s_item_key, p_s_path)
if (search_for_position_by_key(sb, item_key, path)
== POSITION_NOT_FOUND)
reiserfs_panic(p_s_sb,
"PAP-5520: indirect2direct: "
reiserfs_panic(sb, "PAP-5520",
"item to be converted %K does not exist",
p_s_item_key);
copy_item_head(&s_ih, PATH_PITEM_HEAD(p_s_path));
item_key);
copy_item_head(&s_ih, PATH_PITEM_HEAD(path));
#ifdef CONFIG_REISERFS_CHECK
pos = le_ih_k_offset(&s_ih) - 1 +
(ih_item_len(&s_ih) / UNFM_P_SIZE -
1) * p_s_sb->s_blocksize;
1) * sb->s_blocksize;
if (pos != pos1)
reiserfs_panic(p_s_sb, "vs-5530: indirect2direct: "
"tail position changed while we were reading it");
reiserfs_panic(sb, "vs-5530", "tail position "
"changed while we were reading it");
#endif
}
/* Set direct item header to insert. */
make_le_item_head(&s_ih, NULL, get_inode_item_key_version(p_s_inode),
make_le_item_head(&s_ih, NULL, get_inode_item_key_version(inode),
pos1 + 1, TYPE_DIRECT, round_tail_len,
0xffff /*ih_free_space */ );
......@@ -240,13 +242,13 @@ int indirect2direct(struct reiserfs_transaction_handle *th, struct inode *p_s_in
*/
tail = tail + (pos & (PAGE_CACHE_SIZE - 1));
PATH_LAST_POSITION(p_s_path)++;
PATH_LAST_POSITION(path)++;
key = *p_s_item_key;
key = *item_key;
set_cpu_key_k_type(&key, TYPE_DIRECT);
key.key_length = 4;
/* Insert tail as new direct item in the tree */
if (reiserfs_insert_item(th, p_s_path, &key, &s_ih, p_s_inode,
if (reiserfs_insert_item(th, path, &key, &s_ih, inode,
tail ? tail : NULL) < 0) {
/* No disk memory. So we can not convert last unformatted node
to the direct item. In this case we used to adjust
......@@ -255,12 +257,12 @@ int indirect2direct(struct reiserfs_transaction_handle *th, struct inode *p_s_in
unformatted node. For now i_size is considered as guard for
going out of file size */
kunmap(page);
return n_block_size - round_tail_len;
return block_size - round_tail_len;
}
kunmap(page);
/* make sure to get the i_blocks changes from reiserfs_insert_item */
reiserfs_update_sd(th, p_s_inode);
reiserfs_update_sd(th, inode);
// note: we have now the same as in above direct2indirect
// conversion: there are two keys which have matching first three
......@@ -268,11 +270,11 @@ int indirect2direct(struct reiserfs_transaction_handle *th, struct inode *p_s_in
/* We have inserted new direct item and must remove last
unformatted node. */
*p_c_mode = M_CUT;
*mode = M_CUT;
/* we store position of first direct item in the in-core inode */
//mark_file_with_tail (p_s_inode, pos1 + 1);
REISERFS_I(p_s_inode)->i_first_direct_byte = pos1 + 1;
/* mark_file_with_tail (inode, pos1 + 1); */
REISERFS_I(inode)->i_first_direct_byte = pos1 + 1;
return n_block_size - round_tail_len;
return block_size - round_tail_len;
}
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -13,10 +13,7 @@ trusted_get(struct inode *inode, const char *name, void *buffer, size_t size)
if (strlen(name) < sizeof(XATTR_TRUSTED_PREFIX))
return -EINVAL;
if (!reiserfs_xattrs(inode->i_sb))
return -EOPNOTSUPP;
if (!(capable(CAP_SYS_ADMIN) || is_reiserfs_priv_object(inode)))
if (!capable(CAP_SYS_ADMIN) || IS_PRIVATE(inode))
return -EPERM;
return reiserfs_xattr_get(inode, name, buffer, size);
......@@ -29,50 +26,30 @@ trusted_set(struct inode *inode, const char *name, const void *buffer,
if (strlen(name) < sizeof(XATTR_TRUSTED_PREFIX))
return -EINVAL;
if (!reiserfs_xattrs(inode->i_sb))
return -EOPNOTSUPP;
if (!(capable(CAP_SYS_ADMIN) || is_reiserfs_priv_object(inode)))
if (!capable(CAP_SYS_ADMIN) || IS_PRIVATE(inode))
return -EPERM;
return reiserfs_xattr_set(inode, name, buffer, size, flags);
}
static int trusted_del(struct inode *inode, const char *name)
{
if (strlen(name) < sizeof(XATTR_TRUSTED_PREFIX))
return -EINVAL;
if (!reiserfs_xattrs(inode->i_sb))
return -EOPNOTSUPP;
if (!(capable(CAP_SYS_ADMIN) || is_reiserfs_priv_object(inode)))
return -EPERM;
return 0;
}
static int
trusted_list(struct inode *inode, const char *name, int namelen, char *out)
static size_t trusted_list(struct inode *inode, char *list, size_t list_size,
const char *name, size_t name_len)
{
int len = namelen;
if (!reiserfs_xattrs(inode->i_sb))
return 0;
const size_t len = name_len + 1;
if (!(capable(CAP_SYS_ADMIN) || is_reiserfs_priv_object(inode)))
if (!capable(CAP_SYS_ADMIN) || IS_PRIVATE(inode))
return 0;
if (out)
memcpy(out, name, len);
if (list && len <= list_size) {
memcpy(list, name, name_len);
list[name_len] = '\0';
}
return len;
}
struct reiserfs_xattr_handler trusted_handler = {
struct xattr_handler reiserfs_xattr_trusted_handler = {
.prefix = XATTR_TRUSTED_PREFIX,
.get = trusted_get,
.set = trusted_set,
.del = trusted_del,
.list = trusted_list,
};
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -51,7 +51,7 @@ struct reiserfs_inode_info {
/* we use these for fsync or O_SYNC to decide which transaction
** needs to be committed in order for this inode to be properly
** flushed */
unsigned long i_trans_id;
unsigned int i_trans_id;
struct reiserfs_journal_list *i_jl;
struct mutex i_mmap;
#ifdef CONFIG_REISERFS_FS_POSIX_ACL
......@@ -59,7 +59,7 @@ struct reiserfs_inode_info {
struct posix_acl *i_acl_default;
#endif
#ifdef CONFIG_REISERFS_FS_XATTR
struct rw_semaphore xattr_sem;
struct rw_semaphore i_xattr_sem;
#endif
struct inode vfs_inode;
};
......
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment