Skip to content

Commit 300893b

Browse files
committed
Merge tag 'xfs-for-linus-v3.12-rc1' of git://oss.sgi.com/xfs/xfs
Pull xfs updates from Ben Myers: "For 3.12-rc1 there are a number of bugfixes in addition to work to ease usage of shared code between libxfs and the kernel, the rest of the work to enable project and group quotas to be used simultaneously, performance optimisations in the log and the CIL, directory entry file type support, fixes for log space reservations, some spelling/grammar cleanups, and the addition of user namespace support. - introduce readahead to log recovery - add directory entry file type support - fix a number of spelling errors in comments - introduce new Q_XGETQSTATV quotactl for project quotas - add USER_NS support - log space reservation rework - CIL optimisations - kernel/userspace libxfs rework" * tag 'xfs-for-linus-v3.12-rc1' of git://oss.sgi.com/xfs/xfs: (112 commits) xfs: XFS_MOUNT_QUOTA_ALL needed by userspace xfs: dtype changed xfs_dir2_sfe_put_ino to xfs_dir3_sfe_put_ino Fix wrong flag ASSERT in xfs_attr_shortform_getvalue xfs: finish removing IOP_* macros. xfs: inode log reservations are too small xfs: check correct status variable for xfs_inobt_get_rec() call xfs: inode buffers may not be valid during recovery readahead xfs: check LSN ordering for v5 superblocks during recovery xfs: btree block LSN escaping to disk uninitialised XFS: Assertion failed: first <= last && last < BBTOB(bp->b_length), file: fs/xfs/xfs_trans_buf.c, line: 568 xfs: fix bad dquot buffer size in log recovery readahead xfs: don't account buffer cancellation during log recovery readahead xfs: check for underflow in xfs_iformat_fork() xfs: xfs_dir3_sfe_put_ino can be static xfs: introduce object readahead to log recovery xfs: Simplify xfs_ail_min() with list_first_entry_or_null() xfs: Register hotcpu notifier after initialization xfs: add xfs sb v4 support for dirent filetype field xfs: Add write support for dirent filetype field xfs: Add read-only support for dirent filetype field ...
2 parents 45150c4 + 1d03c6f commit 300893b

File tree

116 files changed

+13653
-11951
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

116 files changed

+13653
-11951
lines changed

arch/powerpc/platforms/cell/spufs/inode.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -620,12 +620,16 @@ spufs_parse_options(struct super_block *sb, char *options, struct inode *root)
620620
case Opt_uid:
621621
if (match_int(&args[0], &option))
622622
return 0;
623-
root->i_uid = option;
623+
root->i_uid = make_kuid(current_user_ns(), option);
624+
if (!uid_valid(root->i_uid))
625+
return 0;
624626
break;
625627
case Opt_gid:
626628
if (match_int(&args[0], &option))
627629
return 0;
628-
root->i_gid = option;
630+
root->i_gid = make_kgid(current_user_ns(), option);
631+
if (!gid_valid(root->i_gid))
632+
return 0;
629633
break;
630634
case Opt_mode:
631635
if (match_octal(&args[0], &option))

fs/quota/quota.c

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ static int check_quotactl_permission(struct super_block *sb, int type, int cmd,
2727
case Q_SYNC:
2828
case Q_GETINFO:
2929
case Q_XGETQSTAT:
30+
case Q_XGETQSTATV:
3031
case Q_XQUOTASYNC:
3132
break;
3233
/* allow to query information for dquots we "own" */
@@ -217,6 +218,31 @@ static int quota_getxstate(struct super_block *sb, void __user *addr)
217218
return ret;
218219
}
219220

221+
static int quota_getxstatev(struct super_block *sb, void __user *addr)
222+
{
223+
struct fs_quota_statv fqs;
224+
int ret;
225+
226+
if (!sb->s_qcop->get_xstatev)
227+
return -ENOSYS;
228+
229+
memset(&fqs, 0, sizeof(fqs));
230+
if (copy_from_user(&fqs, addr, 1)) /* Just read qs_version */
231+
return -EFAULT;
232+
233+
/* If this kernel doesn't support user specified version, fail */
234+
switch (fqs.qs_version) {
235+
case FS_QSTATV_VERSION1:
236+
break;
237+
default:
238+
return -EINVAL;
239+
}
240+
ret = sb->s_qcop->get_xstatev(sb, &fqs);
241+
if (!ret && copy_to_user(addr, &fqs, sizeof(fqs)))
242+
return -EFAULT;
243+
return ret;
244+
}
245+
220246
static int quota_setxquota(struct super_block *sb, int type, qid_t id,
221247
void __user *addr)
222248
{
@@ -293,6 +319,8 @@ static int do_quotactl(struct super_block *sb, int type, int cmd, qid_t id,
293319
return quota_setxstate(sb, cmd, addr);
294320
case Q_XGETQSTAT:
295321
return quota_getxstate(sb, addr);
322+
case Q_XGETQSTATV:
323+
return quota_getxstatev(sb, addr);
296324
case Q_XSETQLIM:
297325
return quota_setxquota(sb, type, id, addr);
298326
case Q_XGETQUOTA:
@@ -317,6 +345,7 @@ static int quotactl_cmd_write(int cmd)
317345
case Q_GETINFO:
318346
case Q_SYNC:
319347
case Q_XGETQSTAT:
348+
case Q_XGETQSTATV:
320349
case Q_XGETQUOTA:
321350
case Q_XQUOTASYNC:
322351
return 0;

fs/xfs/Makefile

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,12 @@ xfs-y += xfs_trace.o
2727

2828
# highlevel code
2929
xfs-y += xfs_aops.o \
30+
xfs_attr_inactive.o \
31+
xfs_attr_list.o \
3032
xfs_bit.o \
33+
xfs_bmap_util.o \
3134
xfs_buf.o \
32-
xfs_dfrag.o \
35+
xfs_dir2_readdir.o \
3336
xfs_discard.o \
3437
xfs_error.o \
3538
xfs_export.o \
@@ -44,11 +47,11 @@ xfs-y += xfs_aops.o \
4447
xfs_iops.o \
4548
xfs_itable.o \
4649
xfs_message.o \
50+
xfs_mount.o \
4751
xfs_mru_cache.o \
48-
xfs_rename.o \
4952
xfs_super.o \
50-
xfs_utils.o \
51-
xfs_vnodeops.o \
53+
xfs_symlink.o \
54+
xfs_trans.o \
5255
xfs_xattr.o \
5356
kmem.o \
5457
uuid.o
@@ -73,10 +76,13 @@ xfs-y += xfs_alloc.o \
7376
xfs_ialloc_btree.o \
7477
xfs_icreate_item.o \
7578
xfs_inode.o \
79+
xfs_inode_fork.o \
80+
xfs_inode_buf.o \
7681
xfs_log_recover.o \
77-
xfs_mount.o \
78-
xfs_symlink.o \
79-
xfs_trans.o
82+
xfs_log_rlimit.o \
83+
xfs_sb.o \
84+
xfs_symlink_remote.o \
85+
xfs_trans_resv.o
8086

8187
# low-level transaction/log code
8288
xfs-y += xfs_log.o \

fs/xfs/xfs_acl.c

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,13 @@
1616
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
1717
*/
1818
#include "xfs.h"
19+
#include "xfs_log_format.h"
20+
#include "xfs_trans_resv.h"
1921
#include "xfs_acl.h"
2022
#include "xfs_attr.h"
2123
#include "xfs_bmap_btree.h"
2224
#include "xfs_inode.h"
23-
#include "xfs_vnodeops.h"
25+
#include "xfs_ag.h"
2426
#include "xfs_sb.h"
2527
#include "xfs_mount.h"
2628
#include "xfs_trace.h"
@@ -68,14 +70,15 @@ xfs_acl_from_disk(
6870

6971
switch (acl_e->e_tag) {
7072
case ACL_USER:
73+
acl_e->e_uid = xfs_uid_to_kuid(be32_to_cpu(ace->ae_id));
74+
break;
7175
case ACL_GROUP:
72-
acl_e->e_id = be32_to_cpu(ace->ae_id);
76+
acl_e->e_gid = xfs_gid_to_kgid(be32_to_cpu(ace->ae_id));
7377
break;
7478
case ACL_USER_OBJ:
7579
case ACL_GROUP_OBJ:
7680
case ACL_MASK:
7781
case ACL_OTHER:
78-
acl_e->e_id = ACL_UNDEFINED_ID;
7982
break;
8083
default:
8184
goto fail;
@@ -101,7 +104,18 @@ xfs_acl_to_disk(struct xfs_acl *aclp, const struct posix_acl *acl)
101104
acl_e = &acl->a_entries[i];
102105

103106
ace->ae_tag = cpu_to_be32(acl_e->e_tag);
104-
ace->ae_id = cpu_to_be32(acl_e->e_id);
107+
switch (acl_e->e_tag) {
108+
case ACL_USER:
109+
ace->ae_id = cpu_to_be32(xfs_kuid_to_uid(acl_e->e_uid));
110+
break;
111+
case ACL_GROUP:
112+
ace->ae_id = cpu_to_be32(xfs_kgid_to_gid(acl_e->e_gid));
113+
break;
114+
default:
115+
ace->ae_id = cpu_to_be32(ACL_UNDEFINED_ID);
116+
break;
117+
}
118+
105119
ace->ae_perm = cpu_to_be16(acl_e->e_perm);
106120
}
107121
}
@@ -360,7 +374,7 @@ xfs_xattr_acl_set(struct dentry *dentry, const char *name,
360374
return -EINVAL;
361375
if (type == ACL_TYPE_DEFAULT && !S_ISDIR(inode->i_mode))
362376
return value ? -EACCES : 0;
363-
if ((current_fsuid() != inode->i_uid) && !capable(CAP_FOWNER))
377+
if (!inode_owner_or_capable(inode))
364378
return -EPERM;
365379

366380
if (!value)

fs/xfs/xfs_ag.h

Lines changed: 0 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -226,59 +226,6 @@ typedef struct xfs_agfl {
226226
__be32 agfl_bno[]; /* actually XFS_AGFL_SIZE(mp) */
227227
} xfs_agfl_t;
228228

229-
/*
230-
* Per-ag incore structure, copies of information in agf and agi,
231-
* to improve the performance of allocation group selection.
232-
*/
233-
#define XFS_PAGB_NUM_SLOTS 128
234-
235-
typedef struct xfs_perag {
236-
struct xfs_mount *pag_mount; /* owner filesystem */
237-
xfs_agnumber_t pag_agno; /* AG this structure belongs to */
238-
atomic_t pag_ref; /* perag reference count */
239-
char pagf_init; /* this agf's entry is initialized */
240-
char pagi_init; /* this agi's entry is initialized */
241-
char pagf_metadata; /* the agf is preferred to be metadata */
242-
char pagi_inodeok; /* The agi is ok for inodes */
243-
__uint8_t pagf_levels[XFS_BTNUM_AGF];
244-
/* # of levels in bno & cnt btree */
245-
__uint32_t pagf_flcount; /* count of blocks in freelist */
246-
xfs_extlen_t pagf_freeblks; /* total free blocks */
247-
xfs_extlen_t pagf_longest; /* longest free space */
248-
__uint32_t pagf_btreeblks; /* # of blocks held in AGF btrees */
249-
xfs_agino_t pagi_freecount; /* number of free inodes */
250-
xfs_agino_t pagi_count; /* number of allocated inodes */
251-
252-
/*
253-
* Inode allocation search lookup optimisation.
254-
* If the pagino matches, the search for new inodes
255-
* doesn't need to search the near ones again straight away
256-
*/
257-
xfs_agino_t pagl_pagino;
258-
xfs_agino_t pagl_leftrec;
259-
xfs_agino_t pagl_rightrec;
260-
#ifdef __KERNEL__
261-
spinlock_t pagb_lock; /* lock for pagb_tree */
262-
struct rb_root pagb_tree; /* ordered tree of busy extents */
263-
264-
atomic_t pagf_fstrms; /* # of filestreams active in this AG */
265-
266-
spinlock_t pag_ici_lock; /* incore inode cache lock */
267-
struct radix_tree_root pag_ici_root; /* incore inode cache root */
268-
int pag_ici_reclaimable; /* reclaimable inodes */
269-
struct mutex pag_ici_reclaim_lock; /* serialisation point */
270-
unsigned long pag_ici_reclaim_cursor; /* reclaim restart point */
271-
272-
/* buffer cache index */
273-
spinlock_t pag_buf_lock; /* lock for pag_buf_tree */
274-
struct rb_root pag_buf_tree; /* ordered tree of active buffers */
275-
276-
/* for rcu-safe freeing */
277-
struct rcu_head rcu_head;
278-
#endif
279-
int pagb_count; /* pagb slots in use */
280-
} xfs_perag_t;
281-
282229
/*
283230
* tags for inode radix tree
284231
*/

fs/xfs/xfs_alloc.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -878,7 +878,7 @@ xfs_alloc_ag_vextent_near(
878878
xfs_agblock_t ltnew; /* useful start bno of left side */
879879
xfs_extlen_t rlen; /* length of returned extent */
880880
int forced = 0;
881-
#if defined(DEBUG) && defined(__KERNEL__)
881+
#ifdef DEBUG
882882
/*
883883
* Randomly don't execute the first algorithm.
884884
*/
@@ -938,8 +938,8 @@ xfs_alloc_ag_vextent_near(
938938
xfs_extlen_t blen=0;
939939
xfs_agblock_t bnew=0;
940940

941-
#if defined(DEBUG) && defined(__KERNEL__)
942-
if (!dofirst)
941+
#ifdef DEBUG
942+
if (dofirst)
943943
break;
944944
#endif
945945
/*

fs/xfs/xfs_aops.c

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@
2828
#include "xfs_alloc.h"
2929
#include "xfs_error.h"
3030
#include "xfs_iomap.h"
31-
#include "xfs_vnodeops.h"
3231
#include "xfs_trace.h"
3332
#include "xfs_bmap.h"
33+
#include "xfs_bmap_util.h"
3434
#include <linux/aio.h>
3535
#include <linux/gfp.h>
3636
#include <linux/mpage.h>
@@ -108,7 +108,7 @@ xfs_setfilesize_trans_alloc(
108108

109109
tp = xfs_trans_alloc(mp, XFS_TRANS_FSYNC_TS);
110110

111-
error = xfs_trans_reserve(tp, 0, XFS_FSYNC_TS_LOG_RES(mp), 0, 0, 0);
111+
error = xfs_trans_reserve(tp, &M_RES(mp)->tr_fsyncts, 0, 0);
112112
if (error) {
113113
xfs_trans_cancel(tp, 0);
114114
return error;
@@ -440,7 +440,7 @@ xfs_start_page_writeback(
440440
end_page_writeback(page);
441441
}
442442

443-
static inline int bio_add_buffer(struct bio *bio, struct buffer_head *bh)
443+
static inline int xfs_bio_add_buffer(struct bio *bio, struct buffer_head *bh)
444444
{
445445
return bio_add_page(bio, bh->b_page, bh->b_size, bh_offset(bh));
446446
}
@@ -514,7 +514,7 @@ xfs_submit_ioend(
514514
goto retry;
515515
}
516516

517-
if (bio_add_buffer(bio, bh) != bh->b_size) {
517+
if (xfs_bio_add_buffer(bio, bh) != bh->b_size) {
518518
xfs_submit_ioend_bio(wbc, ioend, bio);
519519
goto retry;
520520
}
@@ -1498,13 +1498,26 @@ xfs_vm_write_failed(
14981498
loff_t pos,
14991499
unsigned len)
15001500
{
1501-
loff_t block_offset = pos & PAGE_MASK;
1501+
loff_t block_offset;
15021502
loff_t block_start;
15031503
loff_t block_end;
15041504
loff_t from = pos & (PAGE_CACHE_SIZE - 1);
15051505
loff_t to = from + len;
15061506
struct buffer_head *bh, *head;
15071507

1508+
/*
1509+
* The request pos offset might be 32 or 64 bit, this is all fine
1510+
* on 64-bit platform. However, for 64-bit pos request on 32-bit
1511+
* platform, the high 32-bit will be masked off if we evaluate the
1512+
* block_offset via (pos & PAGE_MASK) because the PAGE_MASK is
1513+
* 0xfffff000 as an unsigned long, hence the result is incorrect
1514+
* which could cause the following ASSERT failed in most cases.
1515+
* In order to avoid this, we can evaluate the block_offset of the
1516+
* start of the page by using shifts rather than masks the mismatch
1517+
* problem.
1518+
*/
1519+
block_offset = (pos >> PAGE_CACHE_SHIFT) << PAGE_CACHE_SHIFT;
1520+
15081521
ASSERT(block_offset + from == pos);
15091522

15101523
head = page_buffers(page);

0 commit comments

Comments
 (0)