diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2010-05-03 19:36:19 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-05-03 19:36:19 -0400 |
commit | d93ac51c7a129db7a1431d859a3ef45a0b1f3fc5 (patch) | |
tree | c584c3df3abf2c7624d76f7d711b7db1050aa9c4 | |
parent | 37e27e36bc416b07d853d493e6818d6a785507a2 (diff) | |
parent | b0930f8d38c6ab76dc8222a5a910a21392d38208 (diff) |
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/sage/ceph-client
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/sage/ceph-client:
ceph: remove bad auth_x kmem_cache
ceph: fix lockless caps check
ceph: clear dir complete, invalidate dentry on replayed rename
ceph: fix direct io truncate offset
ceph: discard incoming messages with bad seq #
ceph: fix seq counting for skipped messages
ceph: add missing #includes
ceph: fix leaked spinlock during mds reconnect
ceph: print more useful version info on module load
ceph: fix snap realm splits
ceph: clear dir complete on d_move
-rw-r--r-- | fs/ceph/addr.c | 2 | ||||
-rw-r--r-- | fs/ceph/auth.c | 1 | ||||
-rw-r--r-- | fs/ceph/auth_none.h | 2 | ||||
-rw-r--r-- | fs/ceph/auth_x.c | 32 | ||||
-rw-r--r-- | fs/ceph/caps.c | 2 | ||||
-rw-r--r-- | fs/ceph/dir.c | 9 | ||||
-rw-r--r-- | fs/ceph/file.c | 3 | ||||
-rw-r--r-- | fs/ceph/inode.c | 4 | ||||
-rw-r--r-- | fs/ceph/messenger.c | 22 | ||||
-rw-r--r-- | fs/ceph/snap.c | 24 | ||||
-rw-r--r-- | fs/ceph/super.c | 7 | ||||
-rw-r--r-- | fs/ceph/super.h | 1 |
12 files changed, 71 insertions, 38 deletions
diff --git a/fs/ceph/addr.c b/fs/ceph/addr.c index 412593703d1e..4b42c2bb603f 100644 --- a/fs/ceph/addr.c +++ b/fs/ceph/addr.c | |||
@@ -509,7 +509,7 @@ static void writepages_finish(struct ceph_osd_request *req, | |||
509 | u64 bytes = 0; | 509 | u64 bytes = 0; |
510 | struct ceph_client *client = ceph_inode_to_client(inode); | 510 | struct ceph_client *client = ceph_inode_to_client(inode); |
511 | long writeback_stat; | 511 | long writeback_stat; |
512 | unsigned issued = __ceph_caps_issued(ci, NULL); | 512 | unsigned issued = ceph_caps_issued(ci); |
513 | 513 | ||
514 | /* parse reply */ | 514 | /* parse reply */ |
515 | replyhead = msg->front.iov_base; | 515 | replyhead = msg->front.iov_base; |
diff --git a/fs/ceph/auth.c b/fs/ceph/auth.c index f6394b94b866..818afe72e6c7 100644 --- a/fs/ceph/auth.c +++ b/fs/ceph/auth.c | |||
@@ -3,6 +3,7 @@ | |||
3 | #include <linux/module.h> | 3 | #include <linux/module.h> |
4 | #include <linux/slab.h> | 4 | #include <linux/slab.h> |
5 | #include <linux/err.h> | 5 | #include <linux/err.h> |
6 | #include <linux/slab.h> | ||
6 | 7 | ||
7 | #include "types.h" | 8 | #include "types.h" |
8 | #include "auth_none.h" | 9 | #include "auth_none.h" |
diff --git a/fs/ceph/auth_none.h b/fs/ceph/auth_none.h index 56c05533a31c..8164df1a08be 100644 --- a/fs/ceph/auth_none.h +++ b/fs/ceph/auth_none.h | |||
@@ -1,6 +1,8 @@ | |||
1 | #ifndef _FS_CEPH_AUTH_NONE_H | 1 | #ifndef _FS_CEPH_AUTH_NONE_H |
2 | #define _FS_CEPH_AUTH_NONE_H | 2 | #define _FS_CEPH_AUTH_NONE_H |
3 | 3 | ||
4 | #include <linux/slab.h> | ||
5 | |||
4 | #include "auth.h" | 6 | #include "auth.h" |
5 | 7 | ||
6 | /* | 8 | /* |
diff --git a/fs/ceph/auth_x.c b/fs/ceph/auth_x.c index d9001a4dc8cc..fee5a08da881 100644 --- a/fs/ceph/auth_x.c +++ b/fs/ceph/auth_x.c | |||
@@ -12,8 +12,6 @@ | |||
12 | #include "auth.h" | 12 | #include "auth.h" |
13 | #include "decode.h" | 13 | #include "decode.h" |
14 | 14 | ||
15 | struct kmem_cache *ceph_x_ticketbuf_cachep; | ||
16 | |||
17 | #define TEMP_TICKET_BUF_LEN 256 | 15 | #define TEMP_TICKET_BUF_LEN 256 |
18 | 16 | ||
19 | static void ceph_x_validate_tickets(struct ceph_auth_client *ac, int *pneed); | 17 | static void ceph_x_validate_tickets(struct ceph_auth_client *ac, int *pneed); |
@@ -131,13 +129,12 @@ static int ceph_x_proc_ticket_reply(struct ceph_auth_client *ac, | |||
131 | char *ticket_buf; | 129 | char *ticket_buf; |
132 | u8 struct_v; | 130 | u8 struct_v; |
133 | 131 | ||
134 | dbuf = kmem_cache_alloc(ceph_x_ticketbuf_cachep, GFP_NOFS | GFP_ATOMIC); | 132 | dbuf = kmalloc(TEMP_TICKET_BUF_LEN, GFP_NOFS); |
135 | if (!dbuf) | 133 | if (!dbuf) |
136 | return -ENOMEM; | 134 | return -ENOMEM; |
137 | 135 | ||
138 | ret = -ENOMEM; | 136 | ret = -ENOMEM; |
139 | ticket_buf = kmem_cache_alloc(ceph_x_ticketbuf_cachep, | 137 | ticket_buf = kmalloc(TEMP_TICKET_BUF_LEN, GFP_NOFS); |
140 | GFP_NOFS | GFP_ATOMIC); | ||
141 | if (!ticket_buf) | 138 | if (!ticket_buf) |
142 | goto out_dbuf; | 139 | goto out_dbuf; |
143 | 140 | ||
@@ -251,9 +248,9 @@ static int ceph_x_proc_ticket_reply(struct ceph_auth_client *ac, | |||
251 | 248 | ||
252 | ret = 0; | 249 | ret = 0; |
253 | out: | 250 | out: |
254 | kmem_cache_free(ceph_x_ticketbuf_cachep, ticket_buf); | 251 | kfree(ticket_buf); |
255 | out_dbuf: | 252 | out_dbuf: |
256 | kmem_cache_free(ceph_x_ticketbuf_cachep, dbuf); | 253 | kfree(dbuf); |
257 | return ret; | 254 | return ret; |
258 | 255 | ||
259 | bad: | 256 | bad: |
@@ -605,8 +602,6 @@ static void ceph_x_destroy(struct ceph_auth_client *ac) | |||
605 | remove_ticket_handler(ac, th); | 602 | remove_ticket_handler(ac, th); |
606 | } | 603 | } |
607 | 604 | ||
608 | kmem_cache_destroy(ceph_x_ticketbuf_cachep); | ||
609 | |||
610 | kfree(ac->private); | 605 | kfree(ac->private); |
611 | ac->private = NULL; | 606 | ac->private = NULL; |
612 | } | 607 | } |
@@ -641,26 +636,20 @@ int ceph_x_init(struct ceph_auth_client *ac) | |||
641 | int ret; | 636 | int ret; |
642 | 637 | ||
643 | dout("ceph_x_init %p\n", ac); | 638 | dout("ceph_x_init %p\n", ac); |
639 | ret = -ENOMEM; | ||
644 | xi = kzalloc(sizeof(*xi), GFP_NOFS); | 640 | xi = kzalloc(sizeof(*xi), GFP_NOFS); |
645 | if (!xi) | 641 | if (!xi) |
646 | return -ENOMEM; | 642 | goto out; |
647 | 643 | ||
648 | ret = -ENOMEM; | ||
649 | ceph_x_ticketbuf_cachep = kmem_cache_create("ceph_x_ticketbuf", | ||
650 | TEMP_TICKET_BUF_LEN, 8, | ||
651 | (SLAB_RECLAIM_ACCOUNT|SLAB_MEM_SPREAD), | ||
652 | NULL); | ||
653 | if (!ceph_x_ticketbuf_cachep) | ||
654 | goto done_nomem; | ||
655 | ret = -EINVAL; | 644 | ret = -EINVAL; |
656 | if (!ac->secret) { | 645 | if (!ac->secret) { |
657 | pr_err("no secret set (for auth_x protocol)\n"); | 646 | pr_err("no secret set (for auth_x protocol)\n"); |
658 | goto done_nomem; | 647 | goto out_nomem; |
659 | } | 648 | } |
660 | 649 | ||
661 | ret = ceph_crypto_key_unarmor(&xi->secret, ac->secret); | 650 | ret = ceph_crypto_key_unarmor(&xi->secret, ac->secret); |
662 | if (ret) | 651 | if (ret) |
663 | goto done_nomem; | 652 | goto out_nomem; |
664 | 653 | ||
665 | xi->starting = true; | 654 | xi->starting = true; |
666 | xi->ticket_handlers = RB_ROOT; | 655 | xi->ticket_handlers = RB_ROOT; |
@@ -670,10 +659,9 @@ int ceph_x_init(struct ceph_auth_client *ac) | |||
670 | ac->ops = &ceph_x_ops; | 659 | ac->ops = &ceph_x_ops; |
671 | return 0; | 660 | return 0; |
672 | 661 | ||
673 | done_nomem: | 662 | out_nomem: |
674 | kfree(xi); | 663 | kfree(xi); |
675 | if (ceph_x_ticketbuf_cachep) | 664 | out: |
676 | kmem_cache_destroy(ceph_x_ticketbuf_cachep); | ||
677 | return ret; | 665 | return ret; |
678 | } | 666 | } |
679 | 667 | ||
diff --git a/fs/ceph/caps.c b/fs/ceph/caps.c index aa2239fa9a3b..0c1681806867 100644 --- a/fs/ceph/caps.c +++ b/fs/ceph/caps.c | |||
@@ -1861,8 +1861,8 @@ static void kick_flushing_capsnaps(struct ceph_mds_client *mdsc, | |||
1861 | } else { | 1861 | } else { |
1862 | pr_err("%p auth cap %p not mds%d ???\n", inode, | 1862 | pr_err("%p auth cap %p not mds%d ???\n", inode, |
1863 | cap, session->s_mds); | 1863 | cap, session->s_mds); |
1864 | spin_unlock(&inode->i_lock); | ||
1865 | } | 1864 | } |
1865 | spin_unlock(&inode->i_lock); | ||
1866 | } | 1866 | } |
1867 | } | 1867 | } |
1868 | 1868 | ||
diff --git a/fs/ceph/dir.c b/fs/ceph/dir.c index ea8ee2e526aa..650d2db5ed26 100644 --- a/fs/ceph/dir.c +++ b/fs/ceph/dir.c | |||
@@ -880,7 +880,16 @@ static int ceph_rename(struct inode *old_dir, struct dentry *old_dentry, | |||
880 | * do_request, above). If there is no trace, we need | 880 | * do_request, above). If there is no trace, we need |
881 | * to do it here. | 881 | * to do it here. |
882 | */ | 882 | */ |
883 | |||
884 | /* d_move screws up d_subdirs order */ | ||
885 | ceph_i_clear(new_dir, CEPH_I_COMPLETE); | ||
886 | |||
883 | d_move(old_dentry, new_dentry); | 887 | d_move(old_dentry, new_dentry); |
888 | |||
889 | /* ensure target dentry is invalidated, despite | ||
890 | rehashing bug in vfs_rename_dir */ | ||
891 | new_dentry->d_time = jiffies; | ||
892 | ceph_dentry(new_dentry)->lease_shared_gen = 0; | ||
884 | } | 893 | } |
885 | ceph_mdsc_put_request(req); | 894 | ceph_mdsc_put_request(req); |
886 | return err; | 895 | return err; |
diff --git a/fs/ceph/file.c b/fs/ceph/file.c index 4add3d5da2c1..ed6f19721d6e 100644 --- a/fs/ceph/file.c +++ b/fs/ceph/file.c | |||
@@ -665,7 +665,8 @@ more: | |||
665 | * throw out any page cache pages in this range. this | 665 | * throw out any page cache pages in this range. this |
666 | * may block. | 666 | * may block. |
667 | */ | 667 | */ |
668 | truncate_inode_pages_range(inode->i_mapping, pos, pos+len); | 668 | truncate_inode_pages_range(inode->i_mapping, pos, |
669 | (pos+len) | (PAGE_CACHE_SIZE-1)); | ||
669 | } else { | 670 | } else { |
670 | pages = alloc_page_vector(num_pages); | 671 | pages = alloc_page_vector(num_pages); |
671 | if (IS_ERR(pages)) { | 672 | if (IS_ERR(pages)) { |
diff --git a/fs/ceph/inode.c b/fs/ceph/inode.c index 26f883c275e8..261f3e6c0bcf 100644 --- a/fs/ceph/inode.c +++ b/fs/ceph/inode.c | |||
@@ -997,6 +997,10 @@ int ceph_fill_trace(struct super_block *sb, struct ceph_mds_request *req, | |||
997 | dn, dn->d_name.len, dn->d_name.name); | 997 | dn, dn->d_name.len, dn->d_name.name); |
998 | dout("fill_trace doing d_move %p -> %p\n", | 998 | dout("fill_trace doing d_move %p -> %p\n", |
999 | req->r_old_dentry, dn); | 999 | req->r_old_dentry, dn); |
1000 | |||
1001 | /* d_move screws up d_subdirs order */ | ||
1002 | ceph_i_clear(dir, CEPH_I_COMPLETE); | ||
1003 | |||
1000 | d_move(req->r_old_dentry, dn); | 1004 | d_move(req->r_old_dentry, dn); |
1001 | dout(" src %p '%.*s' dst %p '%.*s'\n", | 1005 | dout(" src %p '%.*s' dst %p '%.*s'\n", |
1002 | req->r_old_dentry, | 1006 | req->r_old_dentry, |
diff --git a/fs/ceph/messenger.c b/fs/ceph/messenger.c index cdaaa131add3..509f57d9ccb3 100644 --- a/fs/ceph/messenger.c +++ b/fs/ceph/messenger.c | |||
@@ -1334,6 +1334,7 @@ static int read_partial_message(struct ceph_connection *con) | |||
1334 | unsigned front_len, middle_len, data_len, data_off; | 1334 | unsigned front_len, middle_len, data_len, data_off; |
1335 | int datacrc = con->msgr->nocrc; | 1335 | int datacrc = con->msgr->nocrc; |
1336 | int skip; | 1336 | int skip; |
1337 | u64 seq; | ||
1337 | 1338 | ||
1338 | dout("read_partial_message con %p msg %p\n", con, m); | 1339 | dout("read_partial_message con %p msg %p\n", con, m); |
1339 | 1340 | ||
@@ -1368,6 +1369,25 @@ static int read_partial_message(struct ceph_connection *con) | |||
1368 | return -EIO; | 1369 | return -EIO; |
1369 | data_off = le16_to_cpu(con->in_hdr.data_off); | 1370 | data_off = le16_to_cpu(con->in_hdr.data_off); |
1370 | 1371 | ||
1372 | /* verify seq# */ | ||
1373 | seq = le64_to_cpu(con->in_hdr.seq); | ||
1374 | if ((s64)seq - (s64)con->in_seq < 1) { | ||
1375 | pr_info("skipping %s%lld %s seq %lld, expected %lld\n", | ||
1376 | ENTITY_NAME(con->peer_name), | ||
1377 | pr_addr(&con->peer_addr.in_addr), | ||
1378 | seq, con->in_seq + 1); | ||
1379 | con->in_base_pos = -front_len - middle_len - data_len - | ||
1380 | sizeof(m->footer); | ||
1381 | con->in_tag = CEPH_MSGR_TAG_READY; | ||
1382 | con->in_seq++; | ||
1383 | return 0; | ||
1384 | } else if ((s64)seq - (s64)con->in_seq > 1) { | ||
1385 | pr_err("read_partial_message bad seq %lld expected %lld\n", | ||
1386 | seq, con->in_seq + 1); | ||
1387 | con->error_msg = "bad message sequence # for incoming message"; | ||
1388 | return -EBADMSG; | ||
1389 | } | ||
1390 | |||
1371 | /* allocate message? */ | 1391 | /* allocate message? */ |
1372 | if (!con->in_msg) { | 1392 | if (!con->in_msg) { |
1373 | dout("got hdr type %d front %d data %d\n", con->in_hdr.type, | 1393 | dout("got hdr type %d front %d data %d\n", con->in_hdr.type, |
@@ -1379,6 +1399,7 @@ static int read_partial_message(struct ceph_connection *con) | |||
1379 | con->in_base_pos = -front_len - middle_len - data_len - | 1399 | con->in_base_pos = -front_len - middle_len - data_len - |
1380 | sizeof(m->footer); | 1400 | sizeof(m->footer); |
1381 | con->in_tag = CEPH_MSGR_TAG_READY; | 1401 | con->in_tag = CEPH_MSGR_TAG_READY; |
1402 | con->in_seq++; | ||
1382 | return 0; | 1403 | return 0; |
1383 | } | 1404 | } |
1384 | if (IS_ERR(con->in_msg)) { | 1405 | if (IS_ERR(con->in_msg)) { |
@@ -2030,6 +2051,7 @@ void ceph_con_revoke_message(struct ceph_connection *con, struct ceph_msg *msg) | |||
2030 | ceph_msg_put(con->in_msg); | 2051 | ceph_msg_put(con->in_msg); |
2031 | con->in_msg = NULL; | 2052 | con->in_msg = NULL; |
2032 | con->in_tag = CEPH_MSGR_TAG_READY; | 2053 | con->in_tag = CEPH_MSGR_TAG_READY; |
2054 | con->in_seq++; | ||
2033 | } else { | 2055 | } else { |
2034 | dout("con_revoke_pages %p msg %p pages %p no-op\n", | 2056 | dout("con_revoke_pages %p msg %p pages %p no-op\n", |
2035 | con, con->in_msg, msg); | 2057 | con, con->in_msg, msg); |
diff --git a/fs/ceph/snap.c b/fs/ceph/snap.c index 2b881262ef67..d5114db70453 100644 --- a/fs/ceph/snap.c +++ b/fs/ceph/snap.c | |||
@@ -869,16 +869,20 @@ skip_inode: | |||
869 | continue; | 869 | continue; |
870 | ci = ceph_inode(inode); | 870 | ci = ceph_inode(inode); |
871 | spin_lock(&inode->i_lock); | 871 | spin_lock(&inode->i_lock); |
872 | if (!ci->i_snap_realm) | 872 | if (list_empty(&ci->i_snap_realm_item)) { |
873 | goto split_skip_inode; | 873 | struct ceph_snap_realm *oldrealm = |
874 | ceph_put_snap_realm(mdsc, ci->i_snap_realm); | 874 | ci->i_snap_realm; |
875 | spin_lock(&realm->inodes_with_caps_lock); | 875 | |
876 | list_add(&ci->i_snap_realm_item, | 876 | dout(" moving %p to split realm %llx %p\n", |
877 | &realm->inodes_with_caps); | 877 | inode, realm->ino, realm); |
878 | ci->i_snap_realm = realm; | 878 | spin_lock(&realm->inodes_with_caps_lock); |
879 | spin_unlock(&realm->inodes_with_caps_lock); | 879 | list_add(&ci->i_snap_realm_item, |
880 | ceph_get_snap_realm(mdsc, realm); | 880 | &realm->inodes_with_caps); |
881 | split_skip_inode: | 881 | ci->i_snap_realm = realm; |
882 | spin_unlock(&realm->inodes_with_caps_lock); | ||
883 | ceph_get_snap_realm(mdsc, realm); | ||
884 | ceph_put_snap_realm(mdsc, oldrealm); | ||
885 | } | ||
882 | spin_unlock(&inode->i_lock); | 886 | spin_unlock(&inode->i_lock); |
883 | iput(inode); | 887 | iput(inode); |
884 | } | 888 | } |
diff --git a/fs/ceph/super.c b/fs/ceph/super.c index 75d02eaa1279..f888cf487b7c 100644 --- a/fs/ceph/super.c +++ b/fs/ceph/super.c | |||
@@ -996,9 +996,10 @@ static int __init init_ceph(void) | |||
996 | if (ret) | 996 | if (ret) |
997 | goto out_icache; | 997 | goto out_icache; |
998 | 998 | ||
999 | pr_info("loaded %d.%d.%d (mon/mds/osd proto %d/%d/%d)\n", | 999 | pr_info("loaded (mon/mds/osd proto %d/%d/%d, osdmap %d/%d %d/%d)\n", |
1000 | CEPH_VERSION_MAJOR, CEPH_VERSION_MINOR, CEPH_VERSION_PATCH, | 1000 | CEPH_MONC_PROTOCOL, CEPH_MDSC_PROTOCOL, CEPH_OSDC_PROTOCOL, |
1001 | CEPH_MONC_PROTOCOL, CEPH_MDSC_PROTOCOL, CEPH_OSDC_PROTOCOL); | 1001 | CEPH_OSDMAP_VERSION, CEPH_OSDMAP_VERSION_EXT, |
1002 | CEPH_OSDMAP_INC_VERSION, CEPH_OSDMAP_INC_VERSION_EXT); | ||
1002 | return 0; | 1003 | return 0; |
1003 | 1004 | ||
1004 | out_icache: | 1005 | out_icache: |
diff --git a/fs/ceph/super.h b/fs/ceph/super.h index e30dfbb056c3..13513b80d87f 100644 --- a/fs/ceph/super.h +++ b/fs/ceph/super.h | |||
@@ -10,6 +10,7 @@ | |||
10 | #include <linux/fs.h> | 10 | #include <linux/fs.h> |
11 | #include <linux/mempool.h> | 11 | #include <linux/mempool.h> |
12 | #include <linux/pagemap.h> | 12 | #include <linux/pagemap.h> |
13 | #include <linux/slab.h> | ||
13 | #include <linux/wait.h> | 14 | #include <linux/wait.h> |
14 | #include <linux/writeback.h> | 15 | #include <linux/writeback.h> |
15 | #include <linux/slab.h> | 16 | #include <linux/slab.h> |