summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* ceph: cleanup async writeback, truncation, invalidate helpersSage Weil2010-02-114-43/+65
| | | | | | | Grab inode ref in helper. Make work functions static, with consistent naming. Signed-off-by: Sage Weil <sage@newdream.net>
* ceph: fix sync read eof check deadlockSage Weil2010-02-111-13/+26
| | | | | | | | | | | | | | If a sync read gets a short result from the OSD, it may need to do a getattr to see if it is short due to reaching end-of-file. The getattr was being done while holding a reference to FILE_RD, which can lead to a deadlock if the MDS is revoking that capability bit and can't process the getattr until it does. We fix this by setting a flag if EOF size validation is needed, and doing the getattr in ceph_aio_read, after the RD cap ref is dropped. If the read needs to be continued, we loop and continue traversing the file. Signed-off-by: Sage Weil <sage@newdream.net>
* ceph: do not retain caps that are being revokedSage Weil2010-02-111-4/+6
| | | | | | Never retain caps in __send_cap() that are being revoked. Signed-off-by: Sage Weil <sage@newdream.net>
* ceph: cap revocation fixesSage Weil2010-02-111-5/+17
| | | | | | | | | Try to invalidate pages in ceph_check_caps() if FILE_CACHE is being revoked. If we fail, queue an immediate async invalidate if FILE_CACHE is being revoked. (If it's not being revoked, we just queue the caps for later evaluation later, as per the old behavior.) Signed-off-by: Sage Weil <sage@newdream.net>
* ceph: sync read/write considers page cacheYehuda Sadeh2010-02-111-2/+16
| | | | | | | | | | In the cases where we either do a sync read or a write, we need to make sure that everything in the page cache is flushed. In the case of a sync write we invalidate the relevant pages, so that subsequent read/write reflects the new data written. Signed-off-by: Yehuda Sadeh <yehuda@hq.newdream.net> Signed-off-by: Sage Weil <sage@newdream.net>
* ceph: fix truncation when not holding capsYehuda Sadeh2010-02-111-2/+10
| | | | | | | | | | | A truncation should occur when either we have the specified caps for the file, or (in cases where we are not the only ones referencing the file) when it is mapped or when it is opened. The latter two cases were not handled. Signed-off-by: Yehuda Sadeh <yehuda@hq.newdream.net> Signed-off-by: Sage Weil <sage@newdream.net>
* ceph: refactor ceph_write_begin, fix ceph_page_mkwriteYehuda Sadeh2010-02-111-29/+51
| | | | | | | | | | Originally ceph_page_mkwrite called ceph_write_begin, hoping that the returned locked page would be the page that it was requested to mkwrite. Factored out relevant part of ceph_page_mkwrite and we lock the right page anyway. Signed-off-by: Yehuda Sadeh <yehuda@hq.newdream.net> Signed-off-by: Sage Weil <sage@newdream.net>
* ceph: fix short synchronous readsYehuda Sadeh2010-02-111-9/+9
| | | | | | | | | Zeroing of holes was not done correctly: page_off was miscalculated and zeroing the tail didn't not adjust the 'read' value to include the zeroed portion. Signed-off-by: Yehuda Sadeh <yehuda@hq.newdream.net> Signed-off-by: Sage Weil <sage@newdream.net>
* ceph: add uid field to ceph_pg_poolSage Weil2010-02-112-0/+28
| | | | | | Also verify encoding version as we go. Signed-off-by: Sage Weil <sage@newdream.net>
* ceph: put unused osd connections on lruYehuda Sadeh2010-02-114-9/+76
| | | | | | | | | | Instead of removing osd connection immediately when the requests list is empty, put the osd connection on an lru. Only if that osd has not been used for more than a specified time, will it be removed. Signed-off-by: Yehuda Sadeh <yehuda@hq.newdream.net> Signed-off-by: Sage Weil <sage@newdream.net>
* ceph: remove unused variableYehuda Sadeh2010-02-111-1/+0
| | | | | Signed-off-by: Yehuda Sadeh <yehuda@hq.newdream.net> Signed-off-by: Sage Weil <sage@newdream.net>
* ceph: add support for auth_x authentication protocolSage Weil2010-02-115-1/+801
| | | | | | | | | | | | | | | The auth_x protocol implements support for a kerberos-like mutual authentication infrastructure used by Ceph. We do not simply use vanilla kerberos because of scalability and performance issues when dealing with a large cluster of nodes providing a single logical service. Auth_x provides mutual authentication of client and server and protects against replay and man in the middle attacks. It does not encrypt the full session over the wire, however, so data payload may still be snooped. Signed-off-by: Yehuda Sadeh <yehuda@hq.newdream.net> Signed-off-by: Sage Weil <sage@newdream.net>
* ceph: add struct version to auth encodingSage Weil2010-02-112-0/+4
| | | | | | | Inlucde struct version in encoding. This will streamline future protocol changes. Signed-off-by: Sage Weil <sage@newdream.net>
* ceph: allow renewal of auth credentialsSage Weil2010-02-1110-33/+144
| | | | | | | | | Add infrastructure to allow the mon_client to periodically renew its auth credentials. Also add a messenger callback that will force such a renewal if a peer rejects our authenticator. Signed-off-by: Yehuda Sadeh <yehuda@hq.newdream.net> Signed-off-by: Sage Weil <sage@newdream.net>
* ceph: aes crypto and base64 encode/decode helpersSage Weil2010-02-115-0/+557
| | | | | | | Helpers to encrypt/decrypt AES and base64. Signed-off-by: Yehuda Sadeh <yehuda@hq.newdream.net> Signed-off-by: Sage Weil <sage@newdream.net>
* ceph: buffer decoding helpersSage Weil2010-02-113-0/+53
| | | | | | | | Helper for decoding into a ceph_buffer, and other misc decoding helpers we will need. Signed-off-by: Yehuda Sadeh <yehuda@hq.newdream.net> Signed-off-by: Sage Weil <sage@newdream.net>
* ceph: release all pages after successful osd write responseSage Weil2010-02-031-3/+7
| | | | | | | | | | We release all the pages, even if the osd response was different than the number of pages written. This could only happen due to truncation that arrives the osd in different order, for which we want the pages released anyway. Signed-off-by: Yehuda Sadeh <yehuda@hq.newdream.net> Signed-off-by: Sage Weil <sage@newdream.net>
* ceph: always send truncation info with read and write osd opsYehuda Sadeh2010-02-033-18/+6
| | | | | | | | This fixes a bug where the read/write ops arrive the osd after a following truncation request. Signed-off-by: Yehuda Sadeh <yehuda@hq.newdream.net> Signed-off-by: Sage Weil <sage@newdream.net>
* ceph: remove unreachable codeYehuda Sadeh2010-01-291-9/+0
| | | | | | | We never truncate to a smaller size without contacting the MDS. Signed-off-by: Yehuda Sadeh <yehuda@hq.newdream.net> Signed-off-by: Sage Weil <sage@newdream.net>
* ceph: include type in ceph_entity_addr, filepathSage Weil2010-01-294-3/+6
| | | | | | | Include a type/version in ceph_entity_addr and filepath. Include extra byte in filepath encoding as necessary. Signed-off-by: Sage Weil <sage@newdream.net>
* ceph: precede encoded ceph_pg_pool struct with versionSage Weil2010-01-262-2/+8
| | | | Signed-off-by: Sage Weil <sage@newdream.net>
* ceph: keep reserved replies on the request structureYehuda Sadeh2010-01-254-50/+100
| | | | | | | | This includes treating all the data preallocation and revokation at the same place, not having to have a special case for the reserved pages. Signed-off-by: Yehuda Sadeh <yehuda@hq.newdream.net>
* ceph: alloc message data pages and check if tid existsYehuda Sadeh2010-01-254-59/+45
| | | | | | | | | | | Now doing it in the same callback that is also responsible for allocating the 'front' part of the message. If we get a message that we haven't got a corresponding tid for, mark it for skipping. Moving the mutex unlock/lock from the osd alloc_msg callback to the calling function in the messenger. Signed-off-by: Yehuda Sadeh <yehuda@hq.newdream.net>
* ceph: refactor messages data section allocationYehuda Sadeh2010-01-251-28/+39
| | | | Signed-off-by: Yehuda Sadeh <yehuda@hq.newdream.net>
* ceph: allocate middle of message before stating to readYehuda Sadeh2010-01-255-80/+115
| | | | | | | Both front and middle parts of the message are now being allocated at the ceph_alloc_msg(). Signed-off-by: Yehuda Sadeh <yehuda@hq.newdream.net>
* ceph: properly handle aborted mds requestsSage Weil2010-01-253-11/+34
| | | | | | | | | | | | | | | | | | Previously, if the MDS request was interrupted, we would unregister the request and ignore any reply. This could cause the caps or other cache state to become out of sync. (For instance, aborting dbench and doing rm -r on clients would complain about a non-empty directory because the client didn't realize it's aborted file create request completed.) Even we don't unregister, we still can't process the reply normally because we are no longer holding the caller's locks (like the dir i_mutex). So, mark aborted operations with r_aborted, and in the reply handler, be sure to process all the caps. Do not process the namespace changes, though, since we no longer will hold the dir i_mutex. The dentry lease state can also be ignored as it's more forgiving. Signed-off-by: Sage Weil <sage@newdream.net>
* ceph: mark MDS CREATE as a write opSage Weil2010-01-251-2/+2
| | | | | | CEPH_MDS_OP_CREATE was not correctly marked as a write operation. Signed-off-by: Sage Weil <sage@newdream.net>
* ceph: remove duplicate variable initializationJulia Lawall2010-01-251-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | The variable client is initialized twice to the same (side effect-free) expression. Drop one initialization. A simplified version of the semantic match that finds this problem is: (http://coccinelle.lip6.fr/) // <smpl> @forall@ idexpression *x; identifier f!=ERR_PTR; @@ x = f(...) ... when != x ( x = f(...,<+...x...+>,...) | * x = f(...) ) // </smpl> Signed-off-by: Julia Lawall <julia@diku.dk> Signed-off-by: Sage Weil <sage@newdream.net>
* ceph: display pgid in debugfs osd request dumpSage Weil2010-01-143-2/+7
| | | | Signed-off-by: Sage Weil <sage@newdream.net>
* ceph: remove unused erank fieldSage Weil2010-01-144-32/+15
| | | | | | | The ceph_entity_addr erank field is obsolete; remove it. Get rid of trivial addr comparison helpers while we're at it. Signed-off-by: Sage Weil <sage@newdream.net>
* ceph: change dentry offset and position after splice_dentryYehuda Sadeh2010-01-141-0/+29
| | | | | | | | | This fixes a bug, where we had the parent list have dentries with offsets that are not monotonically increasing, which caused the ceph dcache_readdir to skip entries. Signed-off-by: Yehuda Sadeh <yehuda@hq.newdream.net> Signed-off-by: Sage Weil <sage@newdream.net>
* ceph: fix copy_user_to_page_vector()Yehuda Sadeh2010-01-071-4/+4
| | | | | | | | The function was broken in the case where there was more than one page involved, broke the ceph sync_write case. Signed-off-by: Yehuda Sadeh <yehuda@hq.newdream.net> Signed-off-by: Sage Weil <sage@newdream.net>
* ceph: use ceph_pagelist for mds reconnect message; change encoding (protocol ↵Sage Weil2009-12-232-101/+57
| | | | | | | | | | | | change) Use the ceph_pagelist to encode the MDS reconnect message. We change the message encoding (protocol change!) at the same time to make our life easier (we don't know how many snaprealms we have when we start encoding). An empty message implies the session is closed/does not exist. Signed-off-by: Sage Weil <sage@newdream.net>
* ceph: support ceph_pagelist for message payloadSage Weil2009-12-235-5/+130
| | | | | | | | | | | The ceph_pagelist is a simple list of whole pages, strung together via their lru list_head. It facilitates encoding to a "buffer" of unknown size. Allow its use in place of the ceph_msg page vector. This will be used to fix the huge buffer preallocation woes of MDS reconnection. Signed-off-by: Sage Weil <sage@newdream.net>
* ceph: add feature bits to connection handshake (protocol change)Sage Weil2009-12-234-17/+53
| | | | | | | | Define supported and required feature set. Fail connection if the server requires features we do not support (TAG_FEATURES), or if the server does not support features we require. Signed-off-by: Sage Weil <sage@newdream.net>
* ceph: include transaction id in ceph_msg_header (protocol change)Sage Weil2009-12-237-27/+20
| | | | | | | | | | Many (most?) message types include a transaction id. By including it in the fixed size header, we always have it available even when we are unable to allocate memory for the (larger, variable sized) message body. This will allow us to error out the appropriate request instead of (silently) dropping the reply. Signed-off-by: Sage Weil <sage@newdream.net>
* ceph: more informative msgpool errorsSage Weil2009-12-231-1/+2
| | | | Signed-off-by: Sage Weil <sage@newdream.net>
* ceph: control access to page vector for incoming dataSage Weil2009-12-234-10/+67
| | | | | | | | | | | | | | When we issue an OSD read, we specify a vector of pages that the data is to be read into. The request may be sent multiple times, to multiple OSDs, if the osdmap changes, which means we can get more than one reply. Only read data into the page vector if the reply is coming from the OSD we last sent the request to. Keep track of which connection is using the vector by taking a reference. If another connection was already using the vector before and a new reply comes in on the right connection, revoke the pages from the other connection. Signed-off-by: Sage Weil <sage@newdream.net>
* ceph: use connection mutex to protect read and write stagesSage Weil2009-12-232-19/+33
| | | | | | | | | Use a single mutex (previously out_mutex) to protect both read and write activity from concurrent ceph_con_* calls. Drop the mutex when doing callbacks to avoid nested locking (the callback may need to call something like ceph_con_close). Signed-off-by: Sage Weil <sage@newdream.net>
* ceph: unregister canceled/timed out osd requestsSage Weil2009-12-231-1/+2
| | | | | | | | Canceled or timed out osd requests were getting left in the request list and never deallocated (until umount). Unregister if they are canceled (control-c) or time out. Signed-off-by: Sage Weil <sage@newdream.net>
* ceph: only unregister registered bdiSage Weil2009-12-231-1/+2
| | | | Signed-off-by: Sage Weil <sage@newdream.net>
* ceph: do not touch_caps while iterating over caps listSage Weil2009-12-233-7/+19
| | | | | | | | | | Avoid confusing iterate_session_caps(), flag the session while we are iterating so that __touch_cap does not rearrange items on the list. All other modifiers of session->s_caps do so under the protection of s_mutex. Signed-off-by: Sage Weil <sage@newdream.net>
* ceph: fix incremental osdmap pg_temp decoding bugSage Weil2009-12-221-2/+1
| | | | | | | | | An incremental pg_temp wasn't being decoded properly (wrong bound on for loop). Also remove unused local variable, while we're at it. Signed-off-by: Sage Weil <sage@newdream.net>
* ceph: fix error paths for corrupt osdmap messagesSage Weil2009-12-222-5/+8
| | | | | | | Both osdmap_decode() and osdmap_apply_incremental() should never return NULL. Signed-off-by: Sage Weil <sage@newdream.net>
* ceph: do not drop lease during revalidateSage Weil2009-12-221-2/+0
| | | | | | | We need to hold session s_mutex for __ceph_mdsc_drop_dentry_lease(), which we don't, so skip it. It was purely an optimization. Signed-off-by: Sage Weil <sage@newdream.net>
* ceph: ensure rename target dentry fails revalidationSage Weil2009-12-221-0/+4
| | | | | | | | | | This works around a bug in vfs_rename_dir() that rehashes the target dentry. Ensure such dentries always fail revalidation by timing out the dentry lease and kicking it out of the current directory lease gen. This can be reverted when the vfs bug is fixed. Signed-off-by: Sage Weil <sage@newdream.net>
* ceph: writeback congestion controlYehuda Sadeh2009-12-224-2/+105
| | | | | | | | Set bdi congestion bit when amount of write data in flight exceeds adjustable threshold. Signed-off-by: Yehuda Sadeh <yehuda@hq.newdream.net> Signed-off-by: Sage Weil <sage@newdream.net>
* ceph: writepage grabs and releases inodeYehuda Sadeh2009-12-221-1/+6
| | | | | | | | Fixes a deadlock that is triggered due to kswapd, while the page was locked and the iput couldn't tear down the address space. Signed-off-by: Yehuda Sadeh <yehuda@hq.newdream.net>
* ceph: remove unaccessible codeYehuda Sadeh2009-12-221-4/+0
| | | | Signed-off-by: Yehuda Sadeh <yehuda@hq.newdream.net>
* ceph: include link to bdi in debugfsSage Weil2009-12-222-0/+8
| | | | Signed-off-by: Sage Weil <sage@newdream.net>