summaryrefslogtreecommitdiff
path: root/fs/ceph/inode.c
Commit message (Collapse)AuthorAgeFilesLines
* ceph: use common helper for aborted dir request invalidationSage Weil2010-05-171-15/+2
| | | | | | | We invalidate I_COMPLETE and dentry leases in two places: on aborted mds request and on request replay. Use common helper to avoid duplicate code. Signed-off-by: Sage Weil <sage@newdream.net>
* ceph: set dn offset when splicedSage Weil2010-05-171-34/+37
| | | | | | | | | | We want to assign an offset when the dentry goes from null to linked, which is always done by splice_dentry(). Notably, we should NOT assign an offset when a dentry is first created and is still null. BUG if we try to splice a non-null dentry (we shouldn't). Signed-off-by: Sage Weil <sage@newdream.net>
* ceph: don't clobber i_max_offset on already complete dirSage Weil2010-05-171-1/+2
| | | | | | | This can screw up offsets assigned to new dentries and break dcache readdir results. Signed-off-by: Sage Weil <sage@newdream.net>
* ceph: skip set_dentry_offset work if directory not I_COMPLETESage Weil2010-05-171-0/+4
| | | | Signed-off-by: Sage Weil <sage@newdream.net>
* ceph: fix xattr dangling pointer / double freeSage Weil2010-05-171-0/+1
| | | | | | | | If we use the xattr_blob, clear the pointer so we don't release the memory at the bottom of the fuction. Reported-by: Henry C Chang <henry_c_chang@tcloudcomputing.com> Signed-off-by: Sage Weil <sage@newdream.net>
* ceph: use ceph_sb_to_client instead of ceph_clientCheng Renquan2010-05-171-5/+5
| | | | | | | | | | | | | | | ceph_sb_to_client and ceph_client are really identical, we need to dump one; while function ceph_client is confusing with "struct ceph_client", ceph_sb_to_client's definition is more clear; so we'd better switch all call to ceph_sb_to_client. -static inline struct ceph_client *ceph_client(struct super_block *sb) -{ - return sb->s_fs_info; -} Signed-off-by: Cheng Renquan <crquan@gmail.com> Signed-off-by: Sage Weil <sage@newdream.net>
* ceph: invalidate affected dentry leases on aborted requestsSage Weil2010-05-171-2/+11
| | | | | | | | | | | | | If we abort a request, we return to caller, but the request may still complete. And if we hold the dir FILE_EXCL bit, we may not release a lease when sending a request. A simple un-tar, control-c, un-tar again will reproduce the bug (manifested as a 'Cannot open: File exists'). Ensure we invalidate affected dentry leases (as well dir I_COMPLETE) so we don't have valid (but incorrect) leases. Do the same, consistently, at other sites where I_COMPLETE is similarly cleared. Signed-off-by: Sage Weil <sage@newdream.net>
* ceph: fix open file counting on snapped inodes when mds returns no capsSage Weil2010-05-111-0/+4
| | | | | | | | | It's possible the MDS will not issue caps on a snapped inode, in which case an open request may not __ceph_get_fmode(), botching the open file counting. (This is actually a server bug, but the client shouldn't BUG out in this case.) Signed-off-by: Sage Weil <sage@newdream.net>
* ceph: clear dir complete on d_moveSage Weil2010-05-031-0/+4
| | | | | | | | d_move() reorders the d_subdirs list, breaking the readdir result caching. Unless/until d_move preserves that ordering, clear CEPH_I_COMPLETE on rename. Signed-off-by: Sage Weil <sage@newdream.net>
* ceph: fix dentry rehashing on virtual .snap dirSage Weil2010-03-301-1/+9
| | | | | | | | | | | | | | | | | | | If a lookup fails on the magic .snap directory, we bind it to a magic snap directory inode in ceph_lookup_finish(). That code assumes the dentry is unhashed, but a recent server-side change started returning NULL leases on lookup failure, causing the .snap dentry to be hashed and NULL by ceph_fill_trace(). This causes dentry hash chain corruption, or a dies when d_rehash() includes BUG_ON(!d_unhashed(entry)); So, avoid processing the NULL dentry lease if it the dentry matches the snapdir name in ceph_fill_trace(). That allows the lookup completion to properly bind it to the snapdir inode. BUG there if dentry is hashed to be sure. Signed-off-by: Sage Weil <sage@newdream.net>
* ceph: fix inode removal from snap realm when racing with migrationSage Weil2010-03-201-0/+16
| | | | | | | | | | | When an inode was dropped while being migrated between two MDSs, i_cap_exporting_issued was non-zero such that issue caps were non-zero and __ceph_is_any_caps(ci) was true. This prevented the inode from being removed from the snap realm, even as it was dropped from the cache. Fix this by dropping any residual i_snap_realm ref in destroy_inode. Signed-off-by: Sage Weil <sage@newdream.net>
* ceph: don't truncate dirty pages in invalidate work threadYehuda Sadeh2010-02-191-1/+45
| | | | | | | | | Instead of truncating the whole range of pages, we skip those pages that are dirty or in the middle of writeback. Those pages will be cleared later when the writeback completes. Signed-off-by: Yehuda Sadeh <yehuda@hq.newdream.net> Signed-off-by: Sage Weil <sage@newdream.net>
* ceph: fix typo in ceph_queue_writeback debug outputSage Weil2010-02-171-2/+2
| | | | Signed-off-by: Sage Weil <sage@newdream.net>
* ceph: cleanup async writeback, truncation, invalidate helpersSage Weil2010-02-111-9/+52
| | | | | | | Grab inode ref in helper. Make work functions static, with consistent naming. 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: 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: properly handle aborted mds requestsSage Weil2010-01-251-6/+10
| | | | | | | | | | | | | | | | | | 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: 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: ensure rename target dentry fails revalidationSage Weil2009-12-211-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: simplify ceph_buffer interfaceSage Weil2009-12-071-4/+7
| | | | | | | | | We never allocate the ceph_buffer and buffer separtely, so use a single constructor. Disallow put on NULL buffer; make the caller check. Signed-off-by: Sage Weil <sage@newdream.net>
* ceph: initialize i_size/i_rbytes on snapdirSage Weil2009-11-111-1/+3
| | | | Signed-off-by: Sage Weil <sage@newdream.net>
* ceph: move directory size logic to ceph_getattrSage Weil2009-10-211-3/+5
| | | | | | | | | | We can't fill i_size with rbytes at the fill_file_size stage without adding additional checks for directories. Notably, we want st_blocks to remain 0 on directories so that 'du' still works. Fill in i_blocks, i_size specially in ceph_getattr instead. Signed-off-by: Sage Weil <sage@newdream.net>
* ceph: inode operationsSage Weil2009-10-061-0/+1620
Inode cache and inode operations. We also include routines to incorporate metadata structures returned by the MDS into the client cache, and some helpers to deal with file capabilities and metadata leases. The bulk of that work is done by fill_inode() and fill_trace(). Signed-off-by: Sage Weil <sage@newdream.net>