diff options
Diffstat (limited to 'fs/ocfs2/inode.c')
-rw-r--r-- | fs/ocfs2/inode.c | 46 |
1 files changed, 13 insertions, 33 deletions
diff --git a/fs/ocfs2/inode.c b/fs/ocfs2/inode.c index e1e4882eab4f..08d57a3d4e83 100644 --- a/fs/ocfs2/inode.c +++ b/fs/ocfs2/inode.c | |||
@@ -767,35 +767,6 @@ bail: | |||
767 | return ret; | 767 | return ret; |
768 | } | 768 | } |
769 | 769 | ||
770 | static int ocfs2_request_delete(struct inode *inode) | ||
771 | { | ||
772 | int status = 0; | ||
773 | struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); | ||
774 | |||
775 | if (ocfs2_inode_is_new(inode)) | ||
776 | return 0; | ||
777 | |||
778 | if (ocfs2_node_map_is_only(osb, &osb->mounted_map, | ||
779 | osb->node_num)) | ||
780 | return 0; | ||
781 | /* | ||
782 | * This is how ocfs2 determines whether an inode is still live | ||
783 | * within the cluster. Every node takes a shared read lock on | ||
784 | * the inode open lock in ocfs2_read_locked_inode(). When we | ||
785 | * get to ->delete_inode(), each node tries to convert it's | ||
786 | * lock to an exclusive. Trylocks are serialized by the inode | ||
787 | * meta data lock. If the upconvert suceeds, we know the inode | ||
788 | * is no longer live and can be deleted. | ||
789 | * | ||
790 | * Though we call this with the meta data lock held, the | ||
791 | * trylock keeps us from ABBA deadlock. | ||
792 | */ | ||
793 | status = ocfs2_try_open_lock(inode, 1); | ||
794 | if (status < 0 && status != -EAGAIN) | ||
795 | mlog_errno(status); | ||
796 | return status; | ||
797 | } | ||
798 | |||
799 | /* Query the cluster to determine whether we should wipe an inode from | 770 | /* Query the cluster to determine whether we should wipe an inode from |
800 | * disk or not. | 771 | * disk or not. |
801 | * | 772 | * |
@@ -848,10 +819,19 @@ static int ocfs2_query_inode_wipe(struct inode *inode, | |||
848 | goto bail; | 819 | goto bail; |
849 | } | 820 | } |
850 | 821 | ||
851 | status = ocfs2_request_delete(inode); | 822 | /* |
852 | /* -EAGAIN means that other nodes are still using the | 823 | * This is how ocfs2 determines whether an inode is still live |
853 | * inode. We're done here though, so avoid doing anything on | 824 | * within the cluster. Every node takes a shared read lock on |
854 | * disk and let them worry about deleting it. */ | 825 | * the inode open lock in ocfs2_read_locked_inode(). When we |
826 | * get to ->delete_inode(), each node tries to convert it's | ||
827 | * lock to an exclusive. Trylocks are serialized by the inode | ||
828 | * meta data lock. If the upconvert suceeds, we know the inode | ||
829 | * is no longer live and can be deleted. | ||
830 | * | ||
831 | * Though we call this with the meta data lock held, the | ||
832 | * trylock keeps us from ABBA deadlock. | ||
833 | */ | ||
834 | status = ocfs2_try_open_lock(inode, 1); | ||
855 | if (status == -EAGAIN) { | 835 | if (status == -EAGAIN) { |
856 | status = 0; | 836 | status = 0; |
857 | mlog(0, "Skipping delete of %llu because it is in use on" | 837 | mlog(0, "Skipping delete of %llu because it is in use on" |