Write to a migrated file from acting primary after failover

This use case describes writing to a migrated file from acting primary after failover.

  Fileset: primary 
          State of the file in latest RPO at secondary: migrated
          Action on the file from primary (synced to secondary): No action
          TSM action on the file from secondary: No action
          State of the file in the live filesystem of the secondary: migrated
          Action: Unlink primary feigning disaster and failover to secondary
          State of the file in the live filesystem of the acting primary (after failover): migrated
          Action on the file from acting primary: Write to the file
          State of the in the live filesystem on the acting primary: recall the file and make it resident 

#create a new file in primary, flush it to secondary, create a new RPO snapshot

hs22n21; Fri Sep 18 06:47:09; ~# dd if=/dev/urandom bs=1M count=10 of=/gpfs/fs2/drHSM-DRP-22/file

10+0 records in
10+0 records out
10485760 bytes (10 MB) copied, 1.32672 s, 7.9 MB/s

#check that secondary side RPO snapshot contains this file

0 ;) hs21n30; Fri Sep 18 06:48:39; ~# ls -lashi /gpfs/fs1/drHSM-DRS-22/.snapshots/psnap0-rpo-C0A874465450C18C-179/

total 512
     326   0 drwxrwxrwx 3 root root 4.0K Sep 18 06:43 .
      39 512 dr-xr-xr-x 2 root root 8.0K Dec 31  1969 ..
21495812   0 drwxr-xr-x 3 root root 4.0K Sep 18 06:43 .afm

#migrate the file on secondary side

hs21n30; Fri Sep 18 06:49:04; ~# dsmmigrate /gpfs/fs1/drHSM-DRS-22/file

Tivoli Storage Manager
Command Line Space Management Client Interface
  Client Version 7, Release 1, Level 3.0
  Client date/time: 09/18/15   06:49:06
(c) Copyright by IBM Corporation and other(s) 1990, 2015. All Rights Reserved.
0 ;) hs21n30; Fri Sep 18 06:49:24; ~# dsmls /gpfs/fs1/drHSM-DRS-22/file

Tivoli Storage Manager
Command Line Space Management Client Interface
  Client Version 7, Release 1, Level 3.0
  Client date/time: 09/18/15   06:49:27
(c) Copyright by IBM Corporation and other(s) 1990, 2015. All Rights Reserved.

	ActS         ResS         ResB   FSt    FName
    10485760            0            0   m      file

#trigger a new RPO snapshot

hs22n20; Fri Sep 18 06:48:11; NewSanity# mmpsnap fs2 create -j drHSM-DRP-22 --rpo

Flushing dirty data for snapshot drHSM-DRP-22::psnap-rpo-C0A874465450C18C-179-15-09-18-06-50-05...
Quiescing all file system operations.
Snapshot drHSM-DRP-22::psnap-rpo-C0A874465450C18C-179-15-09-18-06-50-05 created with id 8245.
mmpsnap: The peer snapshot psnap-rpo-C0A874465450C18C-179-15-09-18-06-50-05 is created successfully.

#unlink primary feigning disaster

hs22n20; Fri Sep 18 06:50:42; NewSanity# mmunlinkfileset fs2 drHSM-DRP-22

Unable to start tscr/link/unlink/chfileset on 'fs2' because conflicting program tscr/link/unlink/chfileset is running. Waiting until it completes.
tscr/link/unlink/chfileset on 'fs2' is finished waiting.  Processing continues ...
Fileset drHSM-DRP-22 unlinked.

#failover to secondary

hs21n30; Fri Sep 18 06:51:05; ~# mmafmctl fs1 failoverToSecondary -j drHSM-DRS-22 --restore

mmafmctl: failoverToSecondary restoring from psnap psnap-rpo-C0A874465450C18C-179-15-09-18-06-50-05
[2015-09-18 06:51:09] Restoring fileset "drHSM-DRS-22" from snapshot "psnap-rpo-C0A874465450C18C-179-15-09-18-06-50-05" of filesystem "/dev/fs1"

[2015-09-18 06:51:13] Scanning inodes, phase 1 ...
[2015-09-18 06:51:14] 21496832 inodes have been scanned, 100% of total.
[2015-09-18 06:51:14] There's no data changes since the restoring snapshot, skipping restore.
[2015-09-18 06:51:14] Restore completed successfully.
[2015-09-18 06:51:14] Clean up.
Primary Id (afmPrimaryID) 12646758592946767367-C0A874195583B621-89
Fileset drHSM-DRS-22 changed.
Promoted fileset drHSM-DRS-22 to Primary

#writing to the file from acting primary

hs21n30; Fri Sep 18 06:52:01; ~# dd if=/dev/urandom of=/gpfs/fs1/drHSM-DRS-22/file seek=20 count=10 bs=1M

10+0 records in
10+0 records out
10485760 bytes (10 MB) copied, 1.61107 s, 6.5 MB/s

#checking state of the file on acting primary

0 ;) hs21n30; Fri Sep 18 06:52:26; ~# dsmls /gpfs/fs1/drHSM-DRS-22/file

Tivoli Storage Manager
Command Line Space Management Client Interface
  Client Version 7, Release 1, Level 3.0
  Client date/time: 09/18/15   06:52:28
(c) Copyright by IBM Corporation and other(s) 1990, 2015. All Rights Reserved.

	ActS         ResS         ResB   FSt    FName
    31457280     31457280        20480   r      file