EldoS | Feel safer!

Software components for data protection, secure storage and transfer

Recovery point with SolFS after exception

Also by EldoS: CallbackFilter
A component to monitor and control disk activity, track file and directory operations (create, read, write, rename etc.), alter file data, encrypt files, create virtual files.
#26633
Posted: 09/26/2013 14:14:14
by Sergey  (Basic support level)
Joined: 08/29/2013
Posts: 7

Good day
We have next issue when we try create storage, but no free space exception is occurred, this is ok
We catch it and prompt user to decries storage size, for instance, but it seems that file locked by the driver and 2nd call generate other exception "The process cannot access the file because it is being used by another process"

Maybe we make something wrong?

Thank you for your advice

Code

    public void CreateVolume(string fileName, long spaceRequiredMBytes, string encryptionKey)
    {
      SolFSStorage fsStorage = null;
      try
      {
        var fileSize = (spaceRequiredMBytes*1024*1024);
        if (!File.Exists(fileName))
        {
          var directory = Path.GetDirectoryName(fileName);
          if (!Directory.Exists(directory))
            Directory.CreateDirectory(directory);
          File.Create(fileName).Close();
        }

        fsStorage = new SolFSStorage
          {
            FileName = fileName,
            PageSize = Default_Page_Site
          };
        fsStorage.FormatFixedSize(fileSize, (int) SolFSFormatFlag.ffFastFormat);
      }
      catch (Exception ex)
      {
        var nativeException = new Win32Exception();
        if (nativeException.NativeErrorCode == 112) // ERROR_DISK_FULL
          throw new HiddenFileSystemDiskFullException(ex);
        throw;
      }
      finally
      {
        if (fsStorage != null)
        {
          fsStorage.Close(true);
          fsStorage.Dispose();
          fsStorage = null;
        }
      }
    }
#26634
Posted: 09/26/2013 14:22:42
by Eugene Mayevski (EldoS Corp.)

Thank you for the report. Do I understand you right, that after fsStorage.Close() call the container file on the disk seems to remain locked?


Sincerely yours
Eugene Mayevski
#26635
Posted: 09/26/2013 14:39:34
by Sergey  (Basic support level)
Joined: 08/29/2013
Posts: 7

yes, after fsStorage.Close() file still locked
#26636
Posted: 09/26/2013 23:13:25
by Eugene Mayevski (EldoS Corp.)

Thank you for confirmation. I've moved the post to the helpdesk for evaluation/fixing.


Sincerely yours
Eugene Mayevski

Reply

Statistics

Topic viewed 494 times

Number of guests: 1, registered members: 0, in total hidden: 0




|

Back to top

As of July 15, 2016 EldoS Corporation will operate as a division of /n software inc. For more information, please read the announcement.

Got it!