- /* Lookup "R" to tell if we're on an old OST FS and need to convert
- * from O/R/<dir>/<objid> to O/0/<dir>/<objid>. This can be removed
- * some time post 1.0 when all old-style OSTs have converted along
- * with the init_objid hack. */
- dentry = ll_lookup_one_len("R", O_dentry, 1);
- if (IS_ERR(dentry))
- GOTO(cleanup, rc = PTR_ERR(dentry));
- if (dentry->d_inode && S_ISDIR(dentry->d_inode->i_mode)) {
- struct dentry *O0_dentry = lookup_one_len("0", O_dentry, 1);
- ENTRY;
-
- CWARN("converting OST to new object layout\n");
- if (IS_ERR(O0_dentry)) {
- rc = PTR_ERR(O0_dentry);
- CERROR("error looking up O/0: rc %d\n", rc);
- GOTO(cleanup_R, rc);
- }
-
- if (O0_dentry->d_inode) {
- CERROR("Both O/R and O/0 exist. Fix manually.\n");
- GOTO(cleanup_O0, rc = -EEXIST);
- }
-
- LOCK_INODE_MUTEX(O_dentry->d_inode);
- rc = ll_vfs_rename(O_dentry->d_inode, dentry, filter->fo_vfsmnt,
- O_dentry->d_inode, O0_dentry,
- filter->fo_vfsmnt);
- UNLOCK_INODE_MUTEX(O_dentry->d_inode);
-
- if (rc) {
- CERROR("error renaming O/R to O/0: rc %d\n", rc);
- GOTO(cleanup_O0, rc);
- }
- filter->fo_fsd->lsd_feature_incompat |=
- cpu_to_le32(OBD_INCOMPAT_GROUPS);
- rc = filter_update_server_data(obd, filter->fo_rcvd_filp,
- filter->fo_fsd, 1);
- GOTO(cleanup_O0, rc);
-
- cleanup_O0:
- f_dput(O0_dentry);
- cleanup_R:
- f_dput(dentry);
- if (rc)
- GOTO(cleanup, rc);
- } else {
- f_dput(dentry);
- }
-
- cleanup_phase = 2; /* groups */
-