+ down(&lli->lli_och_sem);
+ if (*och_p) { /* Open handle is present */
+ if (LUSTRE_IT(it)->it_disposition) {
+ struct obd_client_handle *och;
+ /* Well, there's extra open request that we do not need,
+ let's close it somehow*/
+ OBD_ALLOC(och, sizeof (struct obd_client_handle));
+ if (!och) {
+ /* XXX We leak open fd and open OPEN connectioni
+ to server here */
+ up(&lli->lli_och_sem);
+ RETURN(-ENOMEM);
+ }
+ ll_och_fill(inode, it, och);
+ /* ll_md_och_close() will free och */
+ ll_md_och_close(ll_i2mdexp(inode), inode, och);
+ }
+ (*och_usecount)++;
+
+ err = ll_local_open(filp, it, NULL);
+ } else {
+ LASSERT(*och_usecount == 0);
+ OBD_ALLOC(*och_p, sizeof (struct obd_client_handle));
+ if (!*och_p) {
+ // XXX Same as above
+ up(&lli->lli_och_sem);
+ RETURN(-ENOMEM);
+ }
+ (*och_usecount)++;
+
+ err = ll_local_open(filp, it, *och_p);
+ }
+ up(&lli->lli_och_sem);