diff options
Diffstat (limited to 'fs')
-rw-r--r-- | fs/gfs2/inode.c | 20 | ||||
-rw-r--r-- | fs/gfs2/meta_io.h | 23 | ||||
-rw-r--r-- | fs/gfs2/ops_file.c | 9 |
3 files changed, 12 insertions, 40 deletions
diff --git a/fs/gfs2/inode.c b/fs/gfs2/inode.c index e76f345517b7..9fb340984b29 100644 --- a/fs/gfs2/inode.c +++ b/fs/gfs2/inode.c | |||
@@ -277,8 +277,7 @@ int gfs2_dinode_dealloc(struct gfs2_inode *ip) | |||
277 | if (error) | 277 | if (error) |
278 | goto out_rindex_relse; | 278 | goto out_rindex_relse; |
279 | 279 | ||
280 | error = gfs2_trans_begin(sdp, RES_RG_BIT + | 280 | error = gfs2_trans_begin(sdp, RES_RG_BIT + RES_STATFS + RES_QUOTA, 1); |
281 | RES_STATFS + RES_QUOTA, 1); | ||
282 | if (error) | 281 | if (error) |
283 | goto out_rg_gunlock; | 282 | goto out_rg_gunlock; |
284 | 283 | ||
@@ -522,16 +521,13 @@ static int pick_formal_ino_2(struct gfs2_sbd *sdp, uint64_t *formal_ino) | |||
522 | gfs2_trans_add_bh(ip->i_gl, bh, 1); | 521 | gfs2_trans_add_bh(ip->i_gl, bh, 1); |
523 | gfs2_inum_range_out(&ir, bh->b_data + sizeof(struct gfs2_dinode)); | 522 | gfs2_inum_range_out(&ir, bh->b_data + sizeof(struct gfs2_dinode)); |
524 | 523 | ||
525 | out_brelse: | 524 | out_brelse: |
526 | brelse(bh); | 525 | brelse(bh); |
527 | 526 | out_end_trans: | |
528 | out_end_trans: | ||
529 | mutex_unlock(&sdp->sd_inum_mutex); | 527 | mutex_unlock(&sdp->sd_inum_mutex); |
530 | gfs2_trans_end(sdp); | 528 | gfs2_trans_end(sdp); |
531 | 529 | out: | |
532 | out: | ||
533 | gfs2_glock_dq_uninit(&gh); | 530 | gfs2_glock_dq_uninit(&gh); |
534 | |||
535 | return error; | 531 | return error; |
536 | } | 532 | } |
537 | 533 | ||
@@ -593,8 +589,7 @@ static void munge_mode_uid_gid(struct gfs2_inode *dip, unsigned int *mode, | |||
593 | unsigned int *uid, unsigned int *gid) | 589 | unsigned int *uid, unsigned int *gid) |
594 | { | 590 | { |
595 | if (GFS2_SB(&dip->i_inode)->sd_args.ar_suiddir && | 591 | if (GFS2_SB(&dip->i_inode)->sd_args.ar_suiddir && |
596 | (dip->i_di.di_mode & S_ISUID) && | 592 | (dip->i_di.di_mode & S_ISUID) && dip->i_di.di_uid) { |
597 | dip->i_di.di_uid) { | ||
598 | if (S_ISDIR(*mode)) | 593 | if (S_ISDIR(*mode)) |
599 | *mode |= S_ISUID; | 594 | *mode |= S_ISUID; |
600 | else if (dip->i_di.di_uid != current->fsuid) | 595 | else if (dip->i_di.di_uid != current->fsuid) |
@@ -634,10 +629,8 @@ static int alloc_dinode(struct gfs2_inode *dip, struct gfs2_inum *inum, | |||
634 | 629 | ||
635 | out_ipreserv: | 630 | out_ipreserv: |
636 | gfs2_inplace_release(dip); | 631 | gfs2_inplace_release(dip); |
637 | |||
638 | out: | 632 | out: |
639 | gfs2_alloc_put(dip); | 633 | gfs2_alloc_put(dip); |
640 | |||
641 | return error; | 634 | return error; |
642 | } | 635 | } |
643 | 636 | ||
@@ -1300,7 +1293,6 @@ int gfs2_glock_nq_m_atime(unsigned int num_gh, struct gfs2_holder *ghs) | |||
1300 | } | 1293 | } |
1301 | 1294 | ||
1302 | kfree(p); | 1295 | kfree(p); |
1303 | |||
1304 | return error; | 1296 | return error; |
1305 | } | 1297 | } |
1306 | 1298 | ||
@@ -1346,9 +1338,7 @@ int gfs2_setattr_simple(struct gfs2_inode *ip, struct iattr *attr) | |||
1346 | return error; | 1338 | return error; |
1347 | 1339 | ||
1348 | error = __gfs2_setattr_simple(ip, attr); | 1340 | error = __gfs2_setattr_simple(ip, attr); |
1349 | |||
1350 | gfs2_trans_end(GFS2_SB(&ip->i_inode)); | 1341 | gfs2_trans_end(GFS2_SB(&ip->i_inode)); |
1351 | |||
1352 | return error; | 1342 | return error; |
1353 | } | 1343 | } |
1354 | 1344 | ||
diff --git a/fs/gfs2/meta_io.h b/fs/gfs2/meta_io.h index 23c6a596fd9e..951814e86272 100644 --- a/fs/gfs2/meta_io.h +++ b/fs/gfs2/meta_io.h | |||
@@ -17,35 +17,20 @@ static inline void gfs2_buffer_clear(struct buffer_head *bh) | |||
17 | 17 | ||
18 | static inline void gfs2_buffer_clear_tail(struct buffer_head *bh, int head) | 18 | static inline void gfs2_buffer_clear_tail(struct buffer_head *bh, int head) |
19 | { | 19 | { |
20 | BUG_ON(head > bh->b_size); | ||
20 | memset(bh->b_data + head, 0, bh->b_size - head); | 21 | memset(bh->b_data + head, 0, bh->b_size - head); |
21 | } | 22 | } |
22 | 23 | ||
23 | static inline void gfs2_buffer_clear_ends(struct buffer_head *bh, int offset, | ||
24 | int amount, int journaled) | ||
25 | { | ||
26 | int z_off1 = (journaled) ? sizeof(struct gfs2_meta_header) : 0; | ||
27 | int z_len1 = offset - z_off1; | ||
28 | int z_off2 = offset + amount; | ||
29 | int z_len2 = (bh)->b_size - z_off2; | ||
30 | |||
31 | if (z_len1) | ||
32 | memset(bh->b_data + z_off1, 0, z_len1); | ||
33 | |||
34 | if (z_len2) | ||
35 | memset(bh->b_data + z_off2, 0, z_len2); | ||
36 | } | ||
37 | |||
38 | static inline void gfs2_buffer_copy_tail(struct buffer_head *to_bh, | 24 | static inline void gfs2_buffer_copy_tail(struct buffer_head *to_bh, |
39 | int to_head, | 25 | int to_head, |
40 | struct buffer_head *from_bh, | 26 | struct buffer_head *from_bh, |
41 | int from_head) | 27 | int from_head) |
42 | { | 28 | { |
43 | memcpy(to_bh->b_data + to_head, | 29 | BUG_ON(from_head < to_head); |
44 | from_bh->b_data + from_head, | 30 | memcpy(to_bh->b_data + to_head, from_bh->b_data + from_head, |
45 | from_bh->b_size - from_head); | 31 | from_bh->b_size - from_head); |
46 | memset(to_bh->b_data + to_bh->b_size + to_head - from_head, | 32 | memset(to_bh->b_data + to_bh->b_size + to_head - from_head, |
47 | 0, | 33 | 0, from_head - to_head); |
48 | from_head - to_head); | ||
49 | } | 34 | } |
50 | 35 | ||
51 | struct inode *gfs2_aspace_get(struct gfs2_sbd *sdp); | 36 | struct inode *gfs2_aspace_get(struct gfs2_sbd *sdp); |
diff --git a/fs/gfs2/ops_file.c b/fs/gfs2/ops_file.c index d13e04e8a96a..145a29fa4ea4 100644 --- a/fs/gfs2/ops_file.c +++ b/fs/gfs2/ops_file.c | |||
@@ -597,13 +597,11 @@ static int gfs2_open(struct inode *inode, struct file *file) | |||
597 | 597 | ||
598 | return 0; | 598 | return 0; |
599 | 599 | ||
600 | fail_gunlock: | 600 | fail_gunlock: |
601 | gfs2_glock_dq_uninit(&i_gh); | 601 | gfs2_glock_dq_uninit(&i_gh); |
602 | 602 | fail: | |
603 | fail: | ||
604 | file->private_data = NULL; | 603 | file->private_data = NULL; |
605 | kfree(fp); | 604 | kfree(fp); |
606 | |||
607 | return error; | 605 | return error; |
608 | } | 606 | } |
609 | 607 | ||
@@ -736,9 +734,8 @@ static int do_flock(struct file *file, int cmd, struct file_lock *fl) | |||
736 | gfs2_assert_warn(GFS2_SB(&ip->i_inode), !error); | 734 | gfs2_assert_warn(GFS2_SB(&ip->i_inode), !error); |
737 | } | 735 | } |
738 | 736 | ||
739 | out: | 737 | out: |
740 | mutex_unlock(&fp->f_fl_mutex); | 738 | mutex_unlock(&fp->f_fl_mutex); |
741 | |||
742 | return error; | 739 | return error; |
743 | } | 740 | } |
744 | 741 | ||